def __init__(self): super(AdminStatsApp, self).__init__('Admin stats') self._totalExec_begin = ControlDate('Starting date', '2014-10-10') self._totalExec_end = ControlDate('Ending date', '2015-10-10') self._totalExec_btn = ControlButton('Refresh') self._totalExec_graph = ControlVisVis('Total execution time') self._apps_list = ControlCombo('Filter by application') self._totalExecApp_graph = ControlVisVis( 'Total execution time per application') self._servers_list = ControlCombo('Filter by server') self._totalExecServer_graph = ControlVisVis( 'Total execution time per server') self._formset = [ ('_totalExec_begin', '_totalExec_end', '_totalExec_btn'), 'h3:Total execution time', '_totalExec_graph', 'h3:Total execution time per application', '_apps_list', '_totalExecApp_graph', 'h3:Total execution time per server', '_servers_list', '_totalExecServer_graph' ] self._totalExec_btn.value = self.__total_exec_stats self._apps_list.addItem('--- All ---', '') for application in Algorithm.objects.all(): self._apps_list.addItem(str(application.algorithm_name), str(application.algorithm_class)) self._servers_list.addItem('--- All ---', '') for server in Server.objects.all().order_by('server_name'): self._servers_list.addItem(str(server.server_name), str(server.pk))
def __init__(self): super(DOE2py_Utility,self).__init__('DOE2py Utility') self._Input = ControlFile('Input file') self._Weather = ControlFile('Weather file') self._Library = ControlFile('User Library') self._Version = ControlCombo('DOE-2 Version') #self._Status_1 = ControlLabel('Simulation Status:') #self._Status_2 = ControlLabel('-') self._Run = ControlButton('Run Simulation') self._Close = ControlButton('Close') self._formset = ['',(' ','_Input',' '), ('', '_Weather', '' ), ('', '_Library', '' ), ('','_Version', '' ), ('', '_Run', '' ), ('','_Close',''),''] #('','_Status_1','','_Status_2', '' ) self._Run.value = self.__RunAction self._Close.value = self.__CloseAction with open('settings-gui.json') as data_file: data = json.load(data_file) self._Input.value = data["lastinput"] self._Weather.value = data["lastweather"] self._Library.value = data["lastlibrary"] for i in range(0,len(data["doe2versions"])): self._Version.add_item(data["doe2versions"][i])
def __init__(self): super(SimpleExample1, self).__init__('my_variant_api') #init clinvar self._clinvariants = ControlTextArea('rsvariants', 'rs12315123') self._clinbutton = ControlButton('Press this button') self._clinresult = ControlTextArea('result') self._clinbutton.value = self.__clinbuttonAction #init flanking site self._flancchrom = ControlText('chrom') self._flancpos = ControlText('pos') self._flancthree = ControlText('expand_3prime', 300) self._flancfive = ControlText('expand_5prime', 300) self._flancassembly = ControlCombo('assembly') self._flancassembly.add_item('GRCh37') self._flancassembly.add_item('GRCh38') self._flancbutton = ControlButton('Press this button') self._flancresult = ControlTextArea('result') self._flancbutton.value = self.__flancbuttonAction self.formset = [{ "Clinvar": ('_clinvariants', '_clinbutton', '_clinresult'), "Flanking Site": [('_flancchrom', '_flancpos', '_flancthree', '_flancfive', '_flancassembly'), '_flancbutton', '_flancresult'] }]
def __init__(self, axis): super().__init__("Aux Jog") assert isinstance(axis, ControlAxis) self._axis = axis self.label = axis.get_name() self._value_field = ControlText(label="Target", default=str(axis.get_value())) self._set_button = ControlButton(label="Go to target") self._set_button.value = self._update_value self._saved_point_field = ControlCombo(label="Saved Point") self._saved_point_button = ControlButton(label="Go to saved point") self._saved_point_button.value = self._update_saved_point self._current_field = ControlLabel( label="Current Value ({})".format(axis.get_units())) self.setFrameShape(QFrame.StyledPanel) self.setSizePolicy( QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)) self.set_margin(10) self.formset = [("info:{0} ({1}):".format(axis.get_name(), axis.get_units()), '', '', '_current_field'), ('_value_field', '_set_button'), ('_saved_point_field', '_saved_point_button')]
def __init__(self, timeline=None): super(ImportWindow, self).__init__('Import file', parent_win=timeline) self.setContentsMargins(10, 10, 10, 10) self._timeline = timeline # Definition of the forms fields self._filetype = ControlCombo('Please select the type of file you would like to import:') self._importButton = ControlButton('Import') self._panel = ControlEmptyWidget('Panel') self._file = ControlFile('File to import') self._panel.value = self._file self._filetype.add_item('Events file', 0) self._filetype.add_item('Graph file', 1) self._filetype.add_item('Bonsai events file', 2) self._formset = [ ('_filetype', ' '), '_panel', (' ', '_importButton'), ' '] self._filetype.changed_event = self.__fileTypeChanged self._importButton.value = self.__importData from pyforms.gui.dialogs.csv_parser import CsvParserDialog self._graphCsvParserDlg = CsvParserDialog() self._graphCsvParserDlg.xField.label = "Value column" self._graphCsvParserDlg.yField.hide() self._graphCsvParserDlg.zField.hide() self._graphCsvParserDlg.loadButton.hide() self._bonsaiImportDlg = BonsaiImportFileDlg()
def get_custom_config(self): """ Gets a pyforms BaseWidget to complete configuration for LinearAxis """ if self._widget is None: widget = BaseWidget("Linear Axis Config") widget.device_list = ControlCombo(label="Device") widget.device_list += ('None', None) for device in DEVICES: widget.device_list += device if self._linear_stage is not None: widget.value = self._linear_stage.serial_number print("Stage:", self._linear_stage.serial_number) print("Widget:", widget.value) widget.device_list.current_index_changed_event = self._update_stage widget.formset = ['device_list', ''] self._widget = widget self._update_stage(0) if self._linear_stage is not None: self._linear_stage.identify() return self._widget
def __init__(self, name): icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg') TypeColorVideoPipe.__init__(self) OTModulePlugin.__init__(self, name, iconFile=icon_path) self._video = ModuleConnection("Video", connecting=TypeColorVideo) self._player = ControlPlayer("Video player") self._colorDomain = ControlCombo("Color domain") self._colorDomain.add_item("XYZ", cv2.COLOR_BGR2XYZ) self._colorDomain.add_item("YCrCb", cv2.COLOR_BGR2YCR_CB) self._colorDomain.add_item("HSV", cv2.COLOR_BGR2HSV) self._colorDomain.add_item("HLS", cv2.COLOR_BGR2HLS) self._colorDomain.add_item("Lab", cv2.COLOR_BGR2LAB) self._colorDomain.add_item("Luv", cv2.COLOR_BGR2LUV) self._colorDomain.changed_event = self._player.refresh self._video.changed_event = self.newVideoInputChoosen self._player.process_frame_event = self.processFrame self._formset = [ '_video', '_colorDomain', "_player", ]
def __init__(self): super(VehTrajAnalytics, self).__init__('Vehicle Trajectory Analytics') #Definition of the forms fields self._firstname = ControlText('First name', 'Default value') self._middlename = ControlText('Middle name') self._lastname = ControlText('Lastname name') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') self._button2 = ControlButton('Press this button2') self._outputDir = ControlDir("Output Directory") self._inputFile = ControlFile("Input Trajectory File") self._load = ControlButton("Load") self._save = ControlButton("Save") self._vehicleId = ControlCombo("Vehicle id") self._time = ControlCombo("Time(sec)") self._positionX = ControlCombo("PositionX (feet)") self._positionY = ControlCombo("PositionY (feet)") # Instrumented vehicle trajectories self._radarRange = ControlCombo("Radar range (feet)") self._radarAngle = ControlCombo("Radar angle (degrees)") self._centerline = ControlFile("CenterlineFile") #all traffic stream self._lane = ControlCombo("Lane") self._vLength = ControlCombo("Vehicle Length") self._distanceAlong = ControlCombo("Distance Along Corridor") #Define the button action self._button.value = self.__buttonAction self.data = None self.outFolder = None self.formset = [[('_inputFile', '_load'), '_vehicleId', "_time", '_positionX', "_positionY", "_distanceAlong"], "=", { 'All Vehicle Trajectories': ['_lane', '_vLength'], 'Instrumented Vehicle Trajectories': ['_radarAngle', '_radarRange'] }, '=', ('_outputDir', '_save')] self._load.value = self.__loadAction self._save.value = self.__saveAction
def laser_custom_config(): """ Get the GUI config to configure the laser The GUI is the same for each laser axis and for the laser lightsource """ global WIDGET if WIDGET is None: widget = BaseWidget("Laser Config") widget.power_supply = ControlCombo(label="Power Supply") widget.power_supply += ('None', None) for power in DEVICES['Power Supply']: widget.power_supply += power widget.power_supply.current_index_changed_event = update_laser widget.power_channel = ControlNumber(label="Power Supply Channel", default=1, minimum=1, maximum=4) widget.signal_generator = ControlCombo(label="Signal Generator") widget.signal_generator += ('None', None) for signal in DEVICES['Signal Generator']: widget.signal_generator += signal widget.signal_generator.current_index_changed_event = update_laser widget.formset = [ "h5:Laser Using", 'power_supply', 'power_channel', 'signal_generator', "(All laser axis use the same laser)" ] WIDGET = widget return WIDGET
def __init__(self, update_function=None): super().__init__("Light Source Tab") self._update_function = update_function self._device_select = ControlCombo(label="Light Source") self._custom = ControlEmptyWidget() self._device_select.changed_event = self._on_device_change self._device_select.add_item('None', None) for class_type in LightSource.__subclasses__(): self._device_select.add_item(class_type.__name__, class_type)
def __init__(self, done_function): super().__init__("New Axis") self._done_function = done_function self._axis_name = ControlText(label="Name") self._axis_hw_type = ControlCombo(label="HW Type", default=None) for class_type in ControlAxis.__subclasses__(): self._axis_hw_type.add_item(class_type.__name__, class_type) self._done_button = ControlButton(label="Done") self._done_button.value = self._done
def __init__(self, isCreating): Movie.__init__(self, '', '', '', '') BaseWidget.__init__(self, 'Movie') self.__isCreating = isCreating self._idField = ControlText("Id") self._titleField = ControlText("Title") self._descriptionField = ControlTextArea("Description") self._genre = ControlCombo("Genre") for i in MOVIE_GENRE: self._genre += i self._buttonField = ControlButton('Add a new movie') self._buttonField.value = self._updateAction if not isCreating: self._idField.enabled = False self._buttonField.name = "Update movie" self._label = ControlLabel("")
def __init__(self, columns, parent=None): super(GenericCsvParserDialog, self).__init__('CSV Choose the columns', parent_win=parent) self._filename = None self._columns = columns self._columns_indexes = [] self._rownum = 0 # Definition of the forms fields self._filename = ControlFile('CSV File') self._separator = ControlCombo('Separator', default='auto') self._startingrow = ControlNumber('Starting row', default=0) for index, column in enumerate(columns): setattr( self, '_col_{0}'.format(index), ControlNumber(column, default=index, minimum=-1, maximum=1000)) self._filePreview = ControlList('Preview') self._loadButton = ControlButton('Load') form_row = ['_separator'] + [ '_col_{0}'.format(index) for index, column in enumerate(columns) ] + ['_loadButton'] self._formset = [('_filename', '_startingrow'), tuple(form_row), '_filePreview'] self._separator.changed_event = self.__refreshPreview self._filename.changed_event = self.__refreshPreview self._startingrow.changed_event = self.__refreshPreview self._loadButton.value = self.load self._load_event = None self._separator.add_item('auto', 'auto') self._separator.add_item(';', ';') self._separator.add_item(',', ',') self._separator.add_item('TAB', '\t') self._separator.add_item('Excel', csv.excel) self._separator.add_item('Excel TAB', csv.excel_tab)
def __init__(self, name): icon_path = tools.getFileInSameDirectory(__file__, 'iconsubbg.jpg') TypeBWVideoPipe.__init__(self) OTModulePlugin.__init__(self, name, iconFile=icon_path) self._video = ModuleConnection("Video", connecting=TypeComponentsVideoPipe) self._player = ControlPlayer("Video player") self._colorComponent = ControlCombo("Component") self._colorComponent.add_item("A", 0) self._colorComponent.add_item("B", 1) self._colorComponent.add_item("C", 2) self._colorComponent.changed_event = self.refreshValue self._video.changed_event = self.newVideoInputChoosen self._formset = [ '_video', '_colorComponent', "_player", ]
def get_custom_config(self): """ Gets a pyforms BaseWidget to complete configuration for RotationAxis """ if self._widget is None: widget = BaseWidget("Rotate Axis Config") widget.device_list = ControlCombo(label="Device") widget.device_list += ('None', None) for device in DEVICES: widget.device_list += device if self._rotation_stage is not None: widget.value = self._rotation_stage.serial_number widget.device_list.current_index_changed_event = self._update_stage widget.distance_field = ControlNumber( label="Distance to Surface", default=self._distance_to_surface, minimum=0, maximum=float('inf'), decimals=5) widget.distance_field.key_pressed_event = self._update_distance_to_surface widget.formset = ['device_list', 'distance_field', ''] self._widget = widget self._update_stage(0) if self._rotation_stage is not None: self._rotation_stage.identify() return self._widget
def __init__(self, update_function=None): super().__init__("Output Tab") # The update function will be called when the selected sensor changes # to fire the 'sensor' event self._update_function = update_function self._device_select = ControlCombo(label="Sensor") self._custom = ControlEmptyWidget() self._device_select.changed_event = self._on_device_change self._device_select.add_item('None', None) self._output = ControlList() self._live = ControlCheckBox(label="Live Output") self._live.changed_event = self._on_live for class_type in Sensor.__subclasses__(): self._device_select.add_item(class_type.__name__, class_type)
def __init__(self): super(MultipleBlobDetection, self).__init__( 'Multiple Blob Detection') # Definition of the forms fields self._videofile = ControlFile('Video') self._outputfile = ControlText('Results output file') self._threshold_box = ControlCheckBox('Threshold') self._threshold = ControlSlider('Binary Threshold', 114, 0, 255) self._roi_x_min = ControlSlider('ROI x top', 0, 0, 1000) self._roi_x_max = ControlSlider('ROI x bottom', 1000, 0, 1000) self._roi_y_min = ControlSlider('ROI y left', 0, 0, 1000) self._roi_y_max = ControlSlider('ROI y right', 1000, 0, 1000) # self._blobsize = ControlSlider('Minimum blob size', 100, 100, 2000) self._player = ControlPlayer('Player') self._runbutton = ControlButton('Run') self._start_frame = ControlText('Start Frame') self._stop_frame = ControlText('Stop Frame') self._color_list = ControlCombo('Color channels') self._color_list.add_item('Red Image Channel', 2) self._color_list.add_item('Green Image Channel', 1) self._color_list.add_item('Blue Image Channel', 0) self._clahe = ControlCheckBox('CLAHE ') self._dilate = ControlCheckBox('Morphological Dilation') self._dilate_type = ControlCombo('Dilation Kernel Type') self._dilate_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._dilate_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._dilate_type.add_item('CROSS', cv2.MORPH_CROSS) self._dilate_size = ControlSlider('Dilation Kernel Size', 3, 1, 10) self._erode = ControlCheckBox('Morphological Erosion') self._erode_type = ControlCombo('Erode Kernel Type') self._erode_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._erode_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._erode_type.add_item('CROSS', cv2.MORPH_CROSS) self._erode_size = ControlSlider('Erode Kernel Size', 5, 1, 10) self._open = ControlCheckBox('Morphological Opening') self._open_type = ControlCombo('Open Kernel Type') self._open_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._open_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._open_type.add_item('CROSS', cv2.MORPH_CROSS) self._open_size = ControlSlider('Open Kernel Size', 19, 1, 40) self._close = ControlCheckBox('Morphological Closing') self._close_type = ControlCombo('Close Kernel Type') self._close_type.add_item('RECTANGLE', cv2.MORPH_RECT) self._close_type.add_item('ELLIPSE', cv2.MORPH_ELLIPSE) self._close_type.add_item('CROSS', cv2.MORPH_CROSS) self._close_size = ControlSlider('Close Kernel Size', 19, 1, 40) self._LoG = ControlCheckBox('LoG - Laplacian of Gaussian') self._LoG_size = ControlSlider('LoG Kernel Size', 30, 1, 60) self._progress_bar = ControlProgress('Progress Bar') # Define the function that will be called when a file is selected self._videofile.changed_event = self.__videoFileSelectionEvent # Define the event that will be called when the run button is processed self._runbutton.value = self.__runEvent # Define the event called before showing the image in the player self._player.process_frame_event = self.__processFrame # Define the organization of the Form Controls self.formset = [ ('_videofile', '_outputfile'), ('_start_frame', '_stop_frame'), ('_color_list', '_clahe', '_roi_x_min', '_roi_y_min'), ('_threshold_box', '_threshold', '_roi_x_max', '_roi_y_max'), ('_dilate', '_erode', '_open', '_close'), ('_dilate_type', '_erode_type', '_open_type', '_close_type'), ('_dilate_size', '_erode_size', '_open_size', '_close_size'), ('_LoG', '_LoG_size'), '_runbutton', '_progress_bar', '_player' ]
def _update_shown_axis(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] if not axis is None: assert isinstance(axis, ControlAxis) # Get the hardware type from the name of the class self._axis_hw_type.value = type(axis).__name__ # Update the minimum box if not self._min.visible: self._min.visible = True self._min.label = "Minimum ({})".format(axis.get_units()) self._events = False self._min.value = axis.get_min() self._events = True # Update the maximum box if not self._max.visible: self._max.visible = True self._max.label = "Maximum ({})".format(axis.get_units()) self._events = False self._max.value = axis.get_max() self._events = True # Update the norm_minimum box if not self._norm_min.visible: self._norm_min.visible = True self._norm_min.label = " 0% ({})".format(axis.get_units()) self._events = False self._norm_min.value = axis.get_norm_min() self._events = True # Update the norm_maximum box if not self._norm_max.visible: self._norm_max.visible = True self._norm_max.label = "100% ({})".format(axis.get_units()) self._events = False self._norm_max.value = axis.get_norm_max() self._events = True # Populate the special axis combo special_axis = ControlCombo(label="Special Axis") special_axis.add_item('', '') special_axis.add_item("X Axis", 'xaxis') special_axis.add_item("Y Axis", 'yaxis') if axis == self._xaxis: special_axis.value = 'xaxis' elif axis == self._yaxis: special_axis.value = 'yaxis' def axis_changed(_): """ Called when axis changed """ if special_axis.value == 'xaxis': self._xaxis = axis if self._yaxis == axis: self._yaxis = None elif special_axis.value == 'yaxis': self._yaxis = axis if self._xaxis == axis: self._xaxis = None else: if self._xaxis == axis: self._xaxis = None if self._yaxis == axis: self._yaxis = None self._send_events() print("Making Special Combo") special_axis.current_index_changed_event = axis_changed self._events = False self._special_axis.value = None self._special_axis.value = special_axis self._events = True # Update the custom config GUI self._axis_custom.value = axis.get_custom_config() self._save_button.visible = True else: self._axis_hw_type.value = '' self._min.visible = False self._max.visible = False self._norm_min.visible = False self._norm_max.visible = False self._special_axis.value = None self._axis_custom.value = None self._save_button.visible = False else: self._axis_hw_type.value = '' self._min.visible = False self._max.visible = False self._norm_min.visible = False self._norm_max.visible = False self._special_axis.value = None self._axis_custom.value = None self._save_button.visible = False