Пример #1
0
    def __init__(self, parent_win=None):
        BaseWidget.__init__(self, 'Images selector', parent_win=parent_win)

        self._videos = ControlCheckBoxList('Videos filter')
        self._images = ControlCheckBoxList('Images filter')

        Dialog.__init__(self)

        self.formset = [('_videos', '||', '_images')]
        self._videos.selection_changed_event = self.__selection_changed_event
        self._videos.changed_event = self.__update_images
Пример #2
0
    def __init__(self, project=None):
        """

        :param project: project where this board belongs
        :type project: pycontrolgui.models.project.Project
        """
        BaseWidget.__init__(self, 'Board')
        self.layout().setContentsMargins(5, 10, 5, 5)

        self._name = ControlText('Box name')
        self._serial_port = ControlCombo('Serial port')
        self._refresh_serials = ControlButton(
            '',
            icon=QtGui.QIcon(conf.REFRESH_SMALL_ICON),
            default=self.__refresh_serials_pressed,
            helptext="Press here to refresh the list of available devices.")
        self._log_btn = ControlButton('Console')
        self._active_bnc = ControlCheckBoxList('BNC')
        self._active_wired = ControlCheckBoxList('Wired')
        self._active_behavior = ControlCheckBoxList('Behavior')
        self._loadports_btn = ControlButton('Load board info')
        self._netport = ControlNumber('Net port',
                                      default=36000 + len(project.boards),
                                      minimum=36000,
                                      maximum=36100)
        self._events = ControlList('Events', readonly=True)
        self._inputchannels = ControlList('Input channels', readonly=True)
        self._outputchannels = ControlList('Output channels', readonly=True)

        self._saved_serial_port = None

        Board.__init__(self, project)

        self._formset = [
            '_name', ('_serial_port', '_refresh_serials'), '_netport',
            '_log_btn', '=', '_loadports_btn', {
                'Ports': [
                    'Enabled or disable ports',
                    '_active_bnc',
                    '_active_wired',
                    '_active_behavior',
                ],
                'Events': ['_events'],
                'Input ch.': ['_inputchannels'],
                'Output ch.': ['_outputchannels']
            }
        ]
        self._name.changed_event = self.__name_changed_evt
        self._loadports_btn.value = self.__load_bpod_ports

        self._fill_serial_ports()
Пример #3
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._repos = ControlCheckBoxList('Repositories',
                                          headers=['', 'Repositories paths'])
        self._authors = ControlCheckBoxList(
            'Authors', headers=['', 'Author name', 'Email'])
        self._load = ControlButton('Load', default=self.load_data)
        self._save = ControlButton('Save', default=self.save_data)

        self.formset = [no_columns('_load', '_save'), '_repos', '_authors']

        if os.path.exists(self.CONF_FILENAME):
            with open(self.CONF_FILENAME, 'r') as infile:
                self._repos.value, self._authors.value = json.load(infile)
Пример #4
0
    def __init__(self, *args, **kwargs):
        super().__init__('Astrocat GUI')
        self._input_file = ControlFile('Imaging record (*.lsm or *.tiff)')
        #self._json_file = ControlFile('Parameter JSON file')
        self._flags = ControlCheckBoxList('Flags')
        self._morphology_channel = ControlNumber("Morphology channel",
                                                 minimum=0,
                                                 maximum=5,
                                                 default=0)
        self._ca_channel = ControlNumber("Ca channel",
                                         minimum=0,
                                         maximum=5,
                                         default=1)
        self._suff = ControlText("Name suffix", default='astrocat004')
        self._fps = ControlNumber("Movie fps", default=25)
        self._codec = ControlText('Movie codec', default='libx264')

        self._detection_label = ControlLabel('Detection')
        self._detection_loc_nhood = ControlNumber('Nhood', default=5)
        self._detection_loc_stride = ControlNumber('Stride', default=2)
        self._detection_spatial_filter = ControlNumber('Spatial filter',
                                                       default=3)

        self._run_button = ControlButton('Process')
        self._run_button.value = self.__run_button_fired

        self._formset = [
            '_input_file', '=',
            [
                '_detection_label', '_detection_loc_nhood',
                '_detection_loc_stride'
            ], ('_codec', '_fps'), ('_run_button')
        ]
Пример #5
0
    def __init__(self, *args, **kwargs):
        super().__init__('4-Cam')

        self.set_margin(10)

        # Definition of the forms fields
        self._player1 = ControlPlayer('Player1')
        self._player2 = ControlPlayer('Player2')
        self._player3 = ControlPlayer('Player3')
        self._player4 = ControlPlayer('Player4')
        self._runbutton = ControlButton('Stop')
        self._screenshot = ControlButton('Screenshot')
        self._outputfile = ControlDir('Screenshots Ausgabe Ordner')
        self._cams = ControlCheckBoxList('Kameras')

        # Define the event that will be called when the run button is processed
        self._runbutton.value = self.__stopEvent
        self._screenshot.value = self._saveImages

        self.__check_all_avaliable_cameras()

        self.formset = [{
            '0-Kameras': [('_runbutton'), ('_player1', '_player2'),
                          ('_player3', '_player4')],
            '1-Einstellungen': [('_outputfile'), ('_cams')]
        }]

        self._player1.value = self.__assign_capture(0)
        self._player2.value = self.__assign_capture(1)
        self._player3.value = self.__assign_capture(2)
        self._player4.value = self.__assign_capture(3)

        self._outputfile.value = os.getcwd()

        self.__runEvent()
Пример #6
0
	def __init__(self, title='Variables graphs'):
		super(GraphApp,self).__init__(title)

		self._graph   	  = ControlVisVis("Graph")
		self._toggleVars  = ControlButton('Show/Hide variables', checkable=True)
		self._loadGraph   = ControlButton('Apply')
		self._varsList	  = ControlCheckBoxList('Variables')

		self._varsList += ('Frames',True)
		self._varsList += ('X',True)
		self._varsList += ('Y',True)
		self._varsList += ('Z',False)
		self._varsList += ('Velocity',False)
		self._varsList += ('Acceleration',False)

		self._modules_tabs.update({
			'Graphs': [ 
				('_toggleVars',' '),
				'_varsList',
				'_loadGraph',
				'_graph'],
		})
		
		
		self._loadGraph.value 	= self.__calculate_graph
		self._toggleVars.value = self.__show_hide_variables
		self._varsList.hide()
		self._loadGraph.hide()
Пример #7
0
    def __init__(self):
        super(Example1, self).__init__('dir examples')
        self.parent = None
        self._directory = ControlDir('Choose a directory')
        self._file = ControlFile('Choose a file')
        self._filetree = ControlFilesTree('Choose a file')
        self._image = ControlImage('Image')
        self._boundaries = ControlBoundingSlider('Bounding', horizontal=True)
        self._button = ControlButton('Click')

        self._button.value = self.onButtonClick
        # self._directory.value=self.onButtonClick

        self._checkbox = ControlCheckBox('Choose a directory')
        self._checkboxList = ControlCheckBoxList('Choose a file')
        self._player = ControlPlayer('Choose a file')
        self._slider = ControlSlider('Slider')
        self._player.show()
        self._checkboxList.value = [('Item 1', True), ('Item 2', False), ('Item 3', True)]

        self._combobox = ControlCombo('Choose a item')
        self._list = ControlList('List label')
        self._progress = ControlProgress('Progress bar')
        self._visvisVolume = ControlVisVisVolume('Visvis')
        self._timeline = ControlEventTimeline('Timeline')

        self._combobox.add_item('Item 1', 'Value 1')
        self._combobox.add_item('Item 2', 'Value 2')
        self._combobox.add_item('Item 3', 'Value 3')
        self._combobox.add_item('Item 4')

        self._list.value = [('Item1', 'Item2', 'Item3',), ('Item3', 'Item4', 'Item5',)]
        imageWithVolume = np.zeros((100, 100, 100), np.uint8)
        imageWithVolume[30:40, 30:50, :] = 255
        imageWithVolume[30:40, 70:72, :] = 255
        self._visvisVolume.value = imageWithVolume

        self._visvis = ControlVisVis('Visvis')
        values1 = [(i, random.random(), random.random()) for i in range(130)]
        values2 = [(i, random.random(), random.random()) for i in range(130)]
        self._visvis.value = [values1, values2]

        self.formset = [
            '_visvis'
            , '_directory'
            , '_button'
            , '_file'
            , '_boundaries'
            , '_filetree'
            , '_image'
            , '_slider'
            , ('_checkboxList', '_player')
            , ('_checkbox', ' ')
            , ('_combobox', ' ')
            , '_progress'
            , '='
            , ('_visvisVolume', '||', '_list')
            , '_timeline'
        ]
    def __init__(self, parent_win=None, title='Objects selector'):
        BaseWidget.__init__(self, title, parent_win=parent_win)

        self._objects_filter = None

        self._videos = ControlCheckBoxList('Videos filter')
        self._objects = ControlCheckBoxList('Objects filter')

        self._videos.add_popup_menu_option('Select video',
                                           self.__selection_changed_event)

        Dialog.__init__(self)

        self.formset = [('_videos', '||', '_objects')]
        self._videos.selection_changed_event = self.__selection_changed_event
        self._videos.changed_event = self.update_objects
        self._objects.changed_event = self.__objects_changed_event
    def __init__(self, parent_win=None):
        BaseWidget.__init__(self, 'Videos selector', parent_win=parent_win)
        self._videos = ControlCheckBoxList('Videos filter')

        Dialog.__init__(self)

        self.formset = ['_videos']
        self._videos.selection_changed_event = self.__selection_changed_event
Пример #10
0
    def __init__(self):
        # Class Vars:
        self.__players = []  # List of players

        # Player Setup Tab -- Init UI Elements
        #super(MBUI, self).__init__("Millennium Blades Helper")
        BaseWidget.__init__(self, "Millennium Blades Helper")
        self._lstPlayers = ControlList('Player List')
        self._btnAddPl = ControlButton('Add Player')
        self._btnRemPl = ControlButton('Remove Selected Player')
        self._btnGenPl = ControlButton('Generate Player Setup')

        # Player Setup Tab -- Set up properties of UI elements, attach callbacks, etc.
        self._lstPlayers.horizontal_headers = [
            'Name', 'Character', 'Starter Deck'
        ]
        self._btnAddPl.value = self.__onAddPlayerClick
        self._btnRemPl.value = self.__onRemoveSelectedPlayerClick
        self._btnGenPl.value = self.__onGeneratePlayerSetupClick

        # Store Setup Tab -- Init UI Elements
        self._lstStore = ControlList('Store Components')
        self._ckAreaLabel = ControlLabel('Sets To Use')
        self._btnGenerateSt = ControlButton('Generate Store')

        # Store Setup Tab -- Set up properties of UI elements, attach callbacks etc.
        self._lstStore.horizontal_headers = ['Category', 'Sets']
        self._btnGenerateSt.value = self.__onGenerateStoreClick

        # Scoring Tab -- Init UI Components
        self._scoringPanel = ControlEmptyWidget()
        self._btnGetScoring = ControlButton('Generate Score Sheet')

        # Scoring Tab -- Set up properties of UI elements, attach callbacks etc.
        self._btnGetScoring.value = self.__onGenerateScoringClick

        # Set Selection Tab -- Init UI Components
        self._chkArea = ControlCheckBoxList('Sets To Use')

        # Set Selection Tab -- Set up properties of UI elements, attach callbacks etc.
        self._chkArea += ('Base Set', True)
        self._chkArea += ('Set Rotation', True)
        self._chkArea += ('MX #1: Crossover', True)
        self._chkArea += ('MX #2: Sponsors', True)
        self._chkArea += ('MX #3: Fusion Chaos', True)
        self._chkArea += ('MX #4: Final Bosses', True)
        self._chkArea += ('MX #5: Futures', True)
        self._chkArea += ('MX #6: Professionals', True)

        # Set up tabs and component flow for UI
        self.formset = [{
            '1. Player Setup':
            ['_lstPlayers', ' ', ('_btnAddPl', '_btnRemPl', '_btnGenPl')],
            '2. Store Setup': ['_lstStore', ' ', '_btnGenerateSt'],
            '3. Scoring': ['_scoringPanel', '_btnGetScoring'],
            '4. Set Selection': ['_chkArea']
        }]
Пример #11
0
    def _set_chckbx_list(self):
        self.ctrld_w._chckbx_list = \
            ControlCheckBoxList(
                'Select desired surfaces for {} boundary'
                    .format(self.flld_ctrl_label))

        print('self.su2_cfg_obj.available_srfs')
        print(self.su2_cfg_obj.available_srfs)
        self._set_chckbx_list_vals()  # \
    def __init__(self, parent_win=None):
        ObjectsDialog.__init__(
            self,
            parent_win=parent_win,
            title='Datasets selector',
        )

        self._datasets = ControlCheckBoxList('Datasets filter')

        self.formset = [('_videos', '||', '_objects', '||', '_datasets')]

        self._objects.changed_event = self.__update_datasets
        self._datasets.changed_event = self.__datasets_changed_event

        self.load_order = ['_videos', '_objects', '_datasets']
    def __init__(self, parent=None):
        BaseWidget.__init__(self, 'Export data', parent_win=parent)

        self.set_margin(5)
        self.setMinimumHeight(600)
        self.setMinimumWidth(800)

        self._tree = ControlTree('Data')
        self._apply = ControlButton('Apply', checkable=True)
        self._progress = ControlProgress('Progress')
        self._add = ControlButton('Add')
        self._remove = ControlButton('Remove')
        self._export_list = ControlList('Columns to export')

        self._outdir = ControlDir('Output directory')
        self._outfile = ControlText('Output file name')

        self._toggleevts = ControlCheckBox('Split files by events')
        self._splitevents = ControlCheckBoxList('Events')
        self._evtsreload = ControlButton('Reload events')

        self._formset = [[['_add', '_tree'], '||',
                          ['_remove', '_export_list']], '_toggleevts',
                         '_evtsreload', '_splitevents', '_outdir', '_outfile',
                         '_apply', '_progress']

        self._add.value = self.__add_column_event
        self._remove.value = self.__remove_column_event
        self._apply.value = self.__apply_btn_event
        self._evtsreload.value = self.__reload_events
        self._outdir.changed_event = self.__update_outfile_name_event
        self._outfile.changed_event = self.__update_outfile_name_event
        self._toggleevts.changed_event = self.__toggleevents_visibility
        self._splitevents.changed_event = self.__update_outfile_name_event
        self._splitevents.selection_changed_event = self.__update_outfile_name_event

        self._tree.show_header = False
        self._apply.icon = conf.ANNOTATOR_ICON_MOTION
        self._evtsreload.icon = conf.ANNOTATOR_ICON_REFRESH
        self._add.icon = conf.ANNOTATOR_ICON_ADD
        self._remove.icon = conf.ANNOTATOR_ICON_REMOVE

        self._progress.hide()
        self._splitevents.hide()
        self._evtsreload.hide()
        self._apply.enabled = False

        self._properties = []
    def __init__(self, session):
        """
        :param session: session reference
        :type session: pycontrolgui.windows.detail.entities.session_window.SessionWindow
        """
        BaseWidget.__init__(self, session.name)
        self.session = session

        self._refreshbtn = ControlButton('Refresh Timeline')
        self._list = ControlCheckBoxList('Events to show')
        self._events = ControlEventsGraph(session.name)

        self._list.hide()
        self._events.add_popup_menu_option('Show / Hide Events',
                                           self.__toggle_events_to_show_evt)
        self._events.add_track('')
        # for state_id, state_name in sorted(self.session.setup.board_task.states.items(), key=lambda x: x[0]):
        #	self._events.add_track(state_name)

        self._history_index = 0
        self._last_event = None
        self._session_start_timestamp = datetime_now.now()

        self.formset = ['_refreshbtn', '_list', '=', '_events']

        self._list_of_states_colors = [
            '#E0E0E0', '#FFCC99', '#FFFF99', 'CCFF99', '#99FFFF', '#99CCFF',
            '#FF99CC'
        ]

        self._states_names = {}

        self._timer = QTimer()
        self._timer.timeout.connect(self.read_message_queue)

        self._refreshbtn.value = self.__refresh_evt
        self._list.value = [(evt_type.__name__, True)
                            for evt_type in self.EVENTS_TO_SHOW]
        self._list.changed_event = self.__list_changed_evt

        self._available_events = dict([(evt_type.__name__, evt_type)
                                       for evt_type in self.EVENTS_TO_SHOW])

        self.__list_changed_evt()
Пример #15
0
    def __init__(self):
        super(AutoStartPrograms, self).__init__('Autostart programs')

        # select script
        self._selectScript = ControlFile('select startup script: ')
        self._selectScript.changed_event = self.SelectScriptChanged

        # select list
        self._autoStartList = ControlCheckBoxList('autostart items')
        self._autoStartList.value = self.AutoStartList()
        self._autoStartList.changed_event = self.AutoStartListChanged

        # delete button
        self._buttonDelete = ControlButton('delete')
        self._buttonDelete.value = self._buttonDeleteAction

        # close button
        self._buttonClose = ControlButton('close')
        self._buttonClose.value = self._buttonCloseAction
Пример #16
0
    def __init__(self, object2d=None):
        DatasetGUI.__init__(self)
        Contours.__init__(self, object2d)
        BaseWidget.__init__(self, '2D Object', parent_win=object2d)

        self._sel_pts = []

        self._remove_btn = ControlButton('Remove')
        self._layers = ControlCheckBoxList('Layers')
        self._sel_pto_btn = ControlButton('Select point')
        self._switchangle_btn = ControlButton('Switch orientation')
        self._pickcolor = ControlButton('Pick a color',
                                        default=self.__pick_a_color_event)

        self._formset = [
            '_name', '_remove_btn', '_sel_pto_btn', '_switchangle_btn', ' ',
            '_pickcolor', ' ', '_layers'
        ]

        self._switchangle_btn.hide()

        #### set controls ##############################################
        self._remove_btn.icon = conf.ANNOTATOR_ICON_REMOVE
        self._sel_pto_btn.icon = conf.ANNOTATOR_ICON_SELECTPOINT
        self._switchangle_btn.icon = conf.ANNOTATOR_ICON_REMOVE

        #### set events #################################################
        self._remove_btn.value = self.remove_dataset
        self._sel_pto_btn.value = self.__sel_pto_btn_event
        self._switchangle_btn.value = self.__switchangle_btn_event

        self.create_tree_nodes()

        self._layers.value = [('contours', True), ('angle', True),
                              ('velocity vector', True),
                              ('bounding rect', False), ('fit ellipse', False),
                              ('extreme points', False),
                              ('convex hull', False),
                              ('rotated rectangle', False),
                              ('minimum enclosing circle', False),
                              ('minimum enclosing triangle', False)]
Пример #17
0
    def __init__(self, subjectlist, selectedsubjects):

        super(SubjectSelectPopup, self).__init__('Add Subjects')

        self._ok_btn = ControlButton('OK')
        self._cancel_btn = ControlButton('Cancel', default=self.cancel_evt)
        self._subjectslist = ControlCheckBoxList('Subject List')

        self._formset = [
            '', ('', '_subjectslist', ''), ('', '_ok_btn', '_cancel_btn', ''),
            ''
        ]

        for subject in sorted([s for s in subjectlist],
                              key=lambda x: x.name.lower()):
            b = False
            for a in selectedsubjects.value:
                if subject.name == a[0]:
                    self._subjectslist += (subject, True)
                    b = True
            if b is False:
                self._subjectslist += (subject, False)
Пример #18
0
    def __init__(self, parent=None, parent_win=None):
        BaseWidget.__init__(self, 'Events stats', parent_win=parent_win)
        self._parent = parent

        self._bounds = ControlBoundingSlider('Frames range',
                                             1,
                                             100,
                                             horizontal=True)
        self._nframes = ControlNumber('Merge in a group of', 1800)
        self._videofsp = ControlNumber('FPS', 30.0)
        self._analyseButton = ControlButton('Calculate graphs')
        self._events = ControlCheckBoxList()
        self._graph = ControlVisVis('Graph')
        self._showTotalCounts = ControlCheckBox('Show total events counting')
        self._showEvtsCounts = ControlCheckBox('Show events counting', True)
        self._progress = ControlProgress()
        self._exportDurations = ControlButton('Export durations')
        self._exportTotals = ControlButton('Export totals')

        self._formset = [(' ', '_showEvtsCounts', '|', '_showTotalCounts', '|',
                          '_nframes', '_videofsp', '_analyseButton',
                          '_exportDurations', '_exportTotals'), '_bounds', {
                              'a:Graph': ['_graph'],
                              'c:Events selection': ['_events']
                          }, '_progress']

        self._analyseButton.value = self.__generate_graph
        self._exportDurations.value = self.__export_durations
        self._exportTotals.value = self.__export_totals
        self._progress.hide()

        self.__load_events()

        self.set_margin(5)

        self.setMinimumWidth(800)
        self.setMinimumHeight(600)
Пример #19
0
    def set_init_chckbx_list_vals(self):
        """
        Creates sections selection checkbox list and populates the list with
        available sections

        Returns
        -------
        None
            None

        """

        if not self.su2_cfg_obj:
            raise ValueError(
                'please check value of su2_cfg_obj - it seems that it`s empty')
        available_sections = self.su2_cfg_obj.init_cfg_sections_labels
        self.sections_chckbox_list = \
            ControlCheckBoxList('Please select desired sections')
        # self._checkbox_list = ControlCheckBoxList('Sample chbx list')
        self.sections_chckbox_list.value = \
            ((el, True) for el in available_sections)
        CFGSectionSelWidgetCtrl.ctrld_widget.sections_chckbox_list = \
            self.sections_chckbox_list
        self.is_sections_list_set = True
Пример #20
0
    def __init__(self, parent=None):
        super(VideosExporterGui, self).__init__('Videos exporter',
                                                parent_win=parent)

        self.set_margin(5)
        self.setMinimumHeight(400)
        self.setMinimumWidth(400)

        self._toolbox = ControlToolBox('Tool')

        self._panel_area = ControlEmptyWidget('Set the object area',
                                              default=DatasetsDialog(self))
        self._panel_colors = ControlEmptyWidget('Set the object color',
                                                default=DatasetsDialog(self))
        self._panel_imgs = ControlEmptyWidget('Set the video background',
                                              default=ImagesDialog(self))

        #### path panel ################################################
        self._panel_path = ControlEmptyWidget('Set the object path',
                                              default=DatasetsDialog(self))
        self._drawpath = ControlCheckBox('Draw paths')
        ################################################################

        #### draw events ###############################################
        self._drawevents = ControlCheckBoxList('Events')
        self._eventstitles = ControlCheckBox('Draw titles')
        self._evtsreload1 = ControlButton('Reload events')
        ################################################################

        #### split by events ###########################################
        self._splitevents = ControlCheckBoxList('Events')
        self._evtsreload2 = ControlButton('Reload events')
        ################################################################

        self._codec = ControlCheckBox('Force AVI')
        self._outdir = ControlDir('Output directory')
        self._outfile = ControlText('Output file name')

        self._player = ControlPlayer('Player')
        self._progress = ControlProgress('Progress')
        self._apply = ControlButton('Export video(s)', checkable=True)
        self._apply.icon = conf.ANNOTATOR_ICON_PATH
        self._apply.enabled = False

        self._usefixedsize = ControlCheckBox('Use a fixed size')
        self._usefixedcolor = ControlCheckBox('Use a fixed color')
        self._radius = ControlSlider('Circle radius',
                                     default=10,
                                     minimum=1,
                                     maximum=300)
        self._color = ControlText('BGR color', default='255,255,255')

        self.formset = [('_toolbox', '||', '_player'), '=', '_outdir',
                        ('_outfile', '_codec'), '_apply', '_progress']

        self._toolbox.value = [
            ('Path', [self._panel_path, self._drawpath]),
            ('Circle (optional)',
             [self._panel_area, (self._usefixedsize, self._radius)]),
            ('Circle color (optional)',
             [self._panel_colors, (self._usefixedcolor, self._color)]),
            ('Background (optional)', [self._panel_imgs]),
            ('Draw events (optional)',
             [self._evtsreload1, self._drawevents, self._eventstitles]),
            ('Split files by events (optional)',
             [self._evtsreload2, self._splitevents]),
        ]

        self._panel_path.value.datasets_filter = lambda x: isinstance(
            x, (Contours, Path))
        #self._panel_area.value.datasets_filter   = lambda x: isinstance(x, Value )
        self._panel_colors.value.datasets_filter = lambda x: isinstance(
            x, (Contours, Path)) and hasattr(x, 'has_colors_avg'
                                             ) and x.has_colors_avg

        ### Set the controls events #############################################
        self._evtsreload1.value = self.__reload_events
        self._evtsreload2.value = self.__reload_events
        self._outfile.changed_event = self.outputfile_changed_event
        self._usefixedsize.changed_event = self.__usefixedsize_changed_event
        self._usefixedcolor.changed_event = self.__usefixedcolor_changed_event
        self._splitevents.selection_changed_event = self.outputfile_changed_event
        self._panel_path.value.video_selection_changed_event = self.__video_selection_changed_event
        self._codec.changed_event = self.__video_selection_changed_event
        ## function from VideosExporterProcess class
        self._apply.value = self.apply_event
        ## function from VideosExporterPreview class
        self._player.process_frame_event = self.player_processframe_event

        self._evtsreload1.icon = conf.ANNOTATOR_ICON_REFRESH
        self._evtsreload2.icon = conf.ANNOTATOR_ICON_REFRESH

        self._progress.hide()
        self._radius.hide()
        self._color.hide()
        self.__check_areatab_event()
Пример #21
0
    def __init__(self, title=''):
        self._points_values = None  #used to map a color for each tracking point

        super(SceneApp, self).__init__(title)

        ##### CONTROLS ##############################################################################
        self._scene_file = ControlFile('Scene')
        self._scene_toggle_objs_list = ControlButton('Show/Hide objects',
                                                     checkable=True)
        self._scene_objs_list = ControlCheckBoxList('Objects')
        self._scene_opengl = ControlOpenGL('OpengGL Scene')
        self._scene_points_alfa = ControlSlider('Transparency', 10, 0, 100)
        self._scene_bg_color = ControlCombo('Background color')
        self._scene_apply_colorBnds = ControlButton('Apply colors boundaries')
        self._scene_points_size = ControlCombo('Points size')
        self._scene_obj_color = ControlText('Object color')

        #############################################################################################
        self._modules_tabs.update({
            'Heat map':
            [('_heatmapColor', '   |   ', 'Filters:', '_toggleHeatmapVars',
              '_toggleSphereVisibility', '_sphere', '   |   ',
              '_apply2Heatmap', ' '),
             ('_heatmapVarsList', '_heatmapVars', '_heatmapHigherVarsValues',
              '_heatMapMinVar', '_heatmapVarsBnds', '_heatMapMaxVar'),
             ({
                 '1:Map': ['_heatmap'],
                 '0:Scene':
                 [[('_scene_file', ' ', '_scene_toggle_objs_list', ' ',
                    '_scene_bg_color', '  |  ', '_scene_points_size', '  |  ',
                    '_scene_apply_colorBnds'), '_scene_points_alfa',
                   '_scene_obj_color', '_scene_objs_list'], '=',
                  '_scene_opengl']
             }, '_heatmapColorsBnds')]
        })
        #############################################################################################

        self._scene_bg_color += ('White', '1,1,1,1.0')
        self._scene_bg_color += ('Gray', '0.3,0.3,0.3,1.0')
        self._scene_bg_color += ('Black', 'None')

        self._scene_points_size += '1'
        self._scene_points_size += '3'
        self._scene_points_size += '6'
        self._scene_points_size += '8'

        self._scene_objs_list.hide()
        self._scene_obj_color.hide()

        self._scene_objs_list.changed = self.__changed_objects_list_event
        self._scene_toggle_objs_list.value = self.__toggle_objects_list_event
        self._scene_points_alfa.changed = self.__changed_scene_points_alfa_event
        self._scene_bg_color.changed = self.__changed_background_color_event
        self._scene_apply_colorBnds.value = self.__scene_apply_color_bnds_event
        self._scene_points_size.changed = self.__changed_scene_points_size_event
        self._scene_objs_list.selectionChanged = self.__selectionchanged_object_list_event
        self._scene_obj_color.changed = self.__changed_object_color_event

        self._scene = None
        self._scene_file.changed = self.__scene_file_selected

        self._scene_opengl.clear_color = 1, 1, 1, 1
Пример #22
0
    def __init__(self):
        super(SimpleExample1, self).__init__(' Thực Tập Cơ Sở ')

        #main menu
        self.mainmenu = [{
            'File': [{
                'Open Excel': self.__open,
                'icon': 'img/folder_open.png'
            }, '-', {
                'Import': self.__import,
                'icon': 'img/import_icon.png'
            }]
        }]

        #tkinler for messagebox
        root = tk.Tk()
        root.withdraw()

        #list
        self._list = ControlList('Danh sách')
        self._list.readonly = True

        #1.open file excel và heap sort
        self._file = ControlFile('Chọn file Excel')
        self._butheapsort = ControlButton('Heap Sort')
        self._butheapsort.icon = 'img/sort_icon.png'
        self._butheapsort.value = self.__heapsort
        self._butloadexcel = ControlButton('Load')
        self._butloadexcel.icon = 'img/load_icon.png'
        self._butloadexcel.value = self.__load
        self._butremoveloadexcel = ControlButton('Hủy bỏ')
        self._butremoveloadexcel.icon = 'img/remove_icon.png'
        self._butremoveloadexcel.value = self.__removeloadexcel

        #2.thêm thửa đất
        self._diachi = ControlText('Địa chỉ')
        self._dientich = ControlText('Diện tích')
        self._chusohuuhientai = ControlText('Chủ sở hữu hiện tại')
        self._loainha = ControlText('Loại nhà')
        self._mucdichsudung = ControlText('Mục đích Sử dụng')
        self._giatien = ControlText('Giá tiền')
        self._but1 = ControlButton('Thêm thửa đất')
        self._but1.value = self.__add
        self._but1.icon = 'img/add_icon.png'

        #3.tìm kiếm thử đất và xóa
        #tìm kiếm
        self._butsearch = ControlButton('Tìm kiếm')
        self._butsearch.icon = 'img/search_icon.png'
        self._butsearch.value = self.__search
        self._timkiem = ControlText('Tìm Kiếm')
        self._checklisttimkiem = ControlCheckBoxList('Chọn tiêu chí tìm kiếm:')
        self._checklisttimkiem.hide()
        self._buttonhideshowtimkiem = ControlButton('Hiển thị tiêu chí')
        self._buttonhideshowtimkiem.value = self._buthideshowtimkiem
        self._buttonhideshowtimkiem.icon = 'img/show.png'
        self._buthuybo = ControlButton('Hủy bỏ')
        self._buthuybo.icon = 'img/remove_icon.png'
        self._buthuybo.value = self._huybo
        #xóa
        self._textxoa = ControlText('Nhập nội dung cần xóa')
        self._butxoa = ControlButton('Xoá')
        self._butxoa.icon = 'img/delete_icon.png'
        self._butxoa.value = self.__xoa
        self._checklistxoa = ControlCheckBoxList('Chọn tiêu chí xóa:')
        self._checklistxoa.hide()
        self._buttonhideshowxoa = ControlButton('Hiển thị tiêu chí')
        self._buttonhideshowxoa.value = self._buthideshowxoa
        self._buttonhideshowxoa.icon = 'img/show.png'

        #4.xuất
        self._directory = ControlDir('Chọn chỗ xuất file excel')
        self._tenfilexuat = ControlText('Tên file xuất')
        self._butxuat = ControlButton('Xuất')
        self._butxuat.icon = 'img/export_icon.png'
        self._butxuat.value = self.__xuat

        #5.merge
        self._filemerge = ControlFile('Chọn file Excel cần merge')
        self._butimport = ControlButton('Import')
        self._butimport.icon = 'img/import2_icon.png'
        self._butimport.value = self._import
        self._butmerge = ControlButton('Gộp')
        self._butmerge.icon = 'img/merge_icon'
        self._butmerge.value = self._merge
        self._butmerge.hide()
        self._listmerge = ControlList('Danh sách import')
        self._listmerge.readonly = True
        self._buttonhideshow = ControlButton('Hiển thị tùy chọn')
        self._buttonhideshow.value = self._buthideshow
        self._buttonhideshow.hide()
        self._buttonhideshow.icon = 'img/show.png'
        self._checklist = ControlCheckBoxList(
            'Chọn tiêu chí giữ trong danh sách import:')
        self._checklist.hide()
        self._buttonremovemerge = ControlButton('Hủy bỏ')
        self._buttonremovemerge.value = self._remove
        self._buttonremovemerge.icon = 'img/remove_icon.png'
        self._buttonremovemerge.hide()

        #formset as layout
        self.formset = [{
            '1.Mở File và Heap Sort': [
                ' ', '_file', ' ',
                (' ', '_butloadexcel', '_butremoveloadexcel', '_butheapsort',
                 ' '), ' '
            ],
            '2.Thêm': [
                ' ', '_diachi', '_dientich', '_chusohuuhientai', '_loainha',
                '_mucdichsudung', '_giatien', ' ', (' ', '_but1', ' '), ' '
            ],
            '3.Tìm kiếm và Xóa': [
                ' ', '_textxoa', ' ',
                (' ', '_butxoa', '_buttonhideshowxoa', '_checklistxoa', ' '),
                ' ', '_timkiem', ' ',
                (' ', '_butsearch', '_buttonhideshowtimkiem',
                 '_checklisttimkiem', '_buthuybo', ' '), ' '
            ],
            '4.Xuất': [
                ' ', '_directory', ' ', '_tenfilexuat', ' ',
                (' ', '_butxuat', ' '), ' '
            ],
            '5.Merge danh sách': [
                '_filemerge',
                (' ', '_butimport', '_butmerge', '_buttonremovemerge',
                 '_buttonhideshow', '_checklist', ' '), '_listmerge'
            ],
        }, '', '', '_list']
    def __init__(self, parent=None):
        super(ContoursImagesWindow, self).__init__('Contour images', parent_win=parent)
        self.mainwindow = parent

        self.set_margin(5)
        

        self.setMinimumHeight(400)
        self.setMinimumWidth(800)

        self._contourspanel = ControlEmptyWidget('Contours datasets')
        self._progress      = ControlProgress('Progress', visible=False)       
        self._apply         = ControlButton('Apply', checkable=True)
        self._toolbox       = ControlToolBox('Toolbox')
        self._exportdir     = ControlDir('Export images to folder', default='images-from-contour')
        

        #### mask ######################################################
        self._usemaskimg       = ControlCheckBox('Apply a mask to the image')
        self._usemaskdilate    = ControlCheckBox('Dilate the mask and apply it to the image')
        self._maskdilatesize   = ControlSlider('Dilate size', default=0, minimum=0, maximum=100)
        self._usemaskellipse   = ControlCheckBox('Apply the min. ellipse as a mask to the image')
        self._usemaskcircular  = ControlCheckBox('Apply a circular mask to the image')
        self._maskcircularsize = ControlSlider('Circular radius', default=0, minimum=0, maximum=100)
        self._usemaskrect      = ControlCheckBox('Apply the min. rect as a mask to the image')
        ################################################################

        #### margin ####################################################
        self._margin = ControlSlider('Margin size', default=0, minimum=0, maximum=100)
        ################################################################

        #### imagesize #################################################
        self._imagesize = ControlSlider('Image size', default=0, minimum=0, maximum=400)
        ################################################################

        #### cut #######################################################
        self._usecut = ControlCheckBox('Cut image')
        self._cutx = ControlBoundingSlider('X cut', default=(10,30), minimum=0, maximum=1000)
        self._cuty = ControlBoundingSlider('Y cut', default=(10,30), minimum=0, maximum=1000)
        ################################################################
        

        #### use stretch ###############################################
        self._usestretch = ControlCheckBox('Stretch image')
        ################################################################

        #### filter per events #########################################
        self._eventslst  = ControlCheckBoxList('Events', enabled=True)
        self._reloadevts = ControlButton('Reload events', enabled=True, default=self.__reload_events_btn_evt)
        ################################################################

        #### rotation ##################################################
        self._userotup          = ControlCheckBox('Turn the contour always up')
        self._userotdown        = ControlCheckBox('Turn the contour always down')
        self._usefixedangle     = ControlCheckBox('Use a fixed orientation')
        self._fixedangle        = ControlSlider('Rotate the images using a fixed angle', enabled=True, default=0, minimum=0, maximum=360)
        self._usedatasetangle   = ControlCheckBox('Use the orientation of other contour')
        self._datasetanglepanel = ControlEmptyWidget('Datasets for the orientation', enabled=True)
        ################################################################

        #### image position ############################################
        self._useposdataset   = ControlCheckBox('Use a dataset to center the image')
        self._datasetpospanel = ControlEmptyWidget('Datasets for the image position', enabled=True)
        ################################################################

        
        self.formset = [
            '_toolbox',
            '_exportdir',
            '_apply',
            '_progress'
        ]

        self.load_order = [
            '_contourspanel','_userotup', '_userotdown',
            '_exportdir','_usemaskimg','_usemaskdilate','_usemaskellipse','_usemaskellipse',
            '_usemaskcircular', '_maskcircularsize', '_usemaskrect', '_margin', '_imagesize',
            '_usestretch', '_eventslst', '_usefixedangle', '_fixedangle', '_usedatasetangle',
            '_datasetanglepanel', '_useposdataset', '_datasetpospanel', '_usecut', '_cuty', '_cutx'
        ]

        #datasets painel
        self.datasets_dialog = DatasetsDialog(self)
        self.datasets_dialog.datasets_filter = lambda x: isinstance(x, Contours )
        self._contourspanel.value = self.datasets_dialog

        self.posdatasets_dialog = DatasetsDialog(self)
        self.posdatasets_dialog.datasets_filter = lambda x: isinstance(x, (Contours,Path) )
        self._datasetpospanel.value = self.posdatasets_dialog

        self.orientdatasets_dialog = DatasetsDialog(self)
        self.orientdatasets_dialog.datasets_filter = lambda x: isinstance(x, Contours )
        self.orientdatasets_dialog.interval_visible = False
        self._datasetanglepanel.value = self.orientdatasets_dialog


        self._apply.value       = self.__apply_event
        self._apply.icon        = conf.ANNOTATOR_ICON_PATH

        self._imagesize.changed_event = self.__image_size_changed_evt

        self._toolbox.value = [
            ('Extract from contours',(
                self.datasets_dialog,
            )),
            ('Mask',(
                self._usemaskimg,
                (self._usemaskdilate,self._maskdilatesize),
                (self._usemaskcircular,self._maskcircularsize),
                (self._usemaskellipse,self._usemaskrect),
            )),
            ('Margin, image size and stretch image',(
                self._usestretch,
                self._margin, 
                self._imagesize,
                self._usecut,
                self._cutx,
                self._cuty
            )),
            ('Rotate images',(
                (self._userotup, self._userotdown),
                (self._usefixedangle, self._fixedangle),
                self._usedatasetangle,
                self._datasetanglepanel
            )),
            ('Center images',(
                self._useposdataset,
                self._datasetpospanel,
            )),
            ('Export images per events',(
                self._reloadevts,
                self._eventslst,
            )),
        ]

        self.__reload_events_btn_evt()
        self.__image_size_changed_evt()
Пример #24
0
    def __init__(self):
        super(OCSConfig, self).__init__('Restrictor de permisos')

        avail_apps = ""
        avail_apps_list = []
        internet = False
        external = False
        admin = False

        try:
            f = open(FILE)
            for line in f:
                if line[0] != "#":
                    if line.find("AVAILABLE_APPS") > -1:
                        avail_apps = line.split("=")[1][:-1]
                    elif line.find("ALLOW_INTERNET") > -1:
                        if line.split("=")[1].find("YES") > -1:
                            internet = True
                        else:
                            internet = False
                    elif line.find("ALLOW_MOUNT_EXTERNAL") > -1:
                        if line.split("=")[1].find("YES") > -1:
                            external = True
                        else:
                            external = False

                    elif line.find("ADMIN") > -1:
                        if line.split("=")[1].find("YES") > -1:
                            admin = True
                        else:
                            admin = False
            f.close()
            avail_apps_list = avail_apps.split(",")
        except:
            print("Fitxer " + FILE + " inexistent. El cream.")

        #Definition of the forms fields
        self._internet = ControlCheckBox('Permet Internet')
        self._internet.value = internet
        self._externaldev = ControlCheckBox('Permet dispositius externs')
        self._externaldev.value = external
        self._apps = ControlCheckBoxList("Llista d'aplicacions disponibles")
        self._apps += ('libreoffice-calc', 'libreoffice-calc'
                       in avail_apps_list)
        self._apps += ('libreoffice-writer', 'libreoffice-writer'
                       in avail_apps_list)
        self._apps += ('libreoffice-startcenter', 'libreoffice-startcenter'
                       in avail_apps_list)
        self._apps += ('pluma', 'pluma' in avail_apps_list)
        self._apps += ('galculator', 'galculator' in avail_apps_list)

        self._admin = ControlCheckBox('Mode administrador', admin)
        self._admin.value = admin
        self._brestore = ControlButton('Restaura escriptori')
        self._bapply = ControlButton('Aplica')
        self._bexit = ControlButton('Surt')
        self._brestore.value = self.__buttonActionRestore
        self._bapply.value = self.__buttonActionApply
        self._bexit.value = self.__buttonActionCancel
        self.formset = [('_internet', '_externaldev'), '_apps', '_admin', ' ',
                        '_brestore', ('_bapply', '_bexit'), ' ']