def __init__(self, _project=None): BaseWidget.__init__(self, self.TITLE, parent_win=_project) AlyxModule.__init__(self) self.project = _project self._addressbox = ControlText('Address') self._username = ControlText('User:'******'Password:'******'User:'******'Password:'******'Connect', default=self._connect) self._status_lbl = ControlLabel('Status: Not Connected') self._getsubjects_btn = ControlButton('Get Subjects', default=self._get_subjects) self._getsubjects_btn.enabled = False self.set_margin(10) self._addressbox.value = conf.ALYX_PLUGIN_ADDRESS self._addressbox.changed_event = self.setaddr if self.project.loggeduser is not None: self._username.value = self.project.loggeduser.name self._password.form.lineEdit.setEchoMode(QLineEdit.Password) self.formset = [ '_addressbox', '_username', '_password', '_connect_btn', '_status_lbl', '_getsubjects_btn' ]
def __init__(self, task=None, when=None, command=None): title = "Post command editor" if when == TaskCommand.WHEN_POST else "Pre command editor" BaseWidget.__init__(self, title, parent_win=task) self.command = command self.task = task self.when = when self.set_margin(5) self._type = ControlCombo('Type of command', changed_event=self.__type_changed_evt) self._cancelbtn = ControlButton('Cancel', default=self.__cancel_evt) self._okbtn = ControlButton('Ok', default=self.__ok_evt) self._command = ControlText('External command', visible=False) self._filesbrowser = ControlTreeView('Files browser') self._type.add_item('Execute a gui script', 'script') self._type.add_item('Execute a external command', 'external') self.formset = [ '_type', '_command', '_filesbrowser', (' ', '_cancelbtn', '_okbtn'), ' ' ] root_path = os.path.abspath(task.path if task else '/') self.syspath_model = QFileSystemModel(self) self.syspath_model.setRootPath(root_path) self.syspath_model.setNameFilters(['*.py']) self.syspath_model.setNameFilterDisables(False) self._filesbrowser.value = self.syspath_model root_index = self.syspath_model.index(root_path) self._filesbrowser.setRootIndex(root_index) for i in range(1, 4): self._filesbrowser.hideColumn(i)
def __init__(self): super(ExemploSimples,self).__init__('ExemploSimples') #Definition of the forms fields self._nome = ControlText('Nome', 'Default value') self._sobrename = ControlText('Sobrenome') self._nomeCompleto = ControlText('Nome completo') self._button = ControlButton('Pressione o Botão')
def __init__(self, _project): BaseWidget.__init__(self, self.TITLE) AlyxModule.__init__(self) User.__init__(self, _project) self.project = _project self._namebox = ControlText('User:'******'Password:'******'Connect',default = self._connect) self._status_lbl = ControlLabel('Status: Not Connected') self._getsubjects_btn = ControlButton('Get Subjects', default = self._get_subjects) self.set_margin(10) self._namebox.value = self._name self._namebox.changed_event = self.__name_changed_evt self._password.form.lineEdit.setEchoMode(QLineEdit.Password) self.formset = [ '_namebox', '_password', '_connect_btn', '_status_lbl', '_getsubjects_btn' ] self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
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') ]
def __init__(self): super(FundCalculatorGUI, self).__init__('FundCalculatorGUI') self.daily_report = ControlLabel() self.current_fund = ControlLabel('Current Fund:') self.fund_code = ControlText('Fund Code:') self.fund_amount = ControlText('Fund Amount:') self.add_fund_button = ControlButton('Add Fund') self.add_fund_button.value = self.add_fund self.sender_address = ControlText('Sender Address:') self.sender_password = ControlText('Sender Password:'******'Receiver Address:') self.current_status_label = ControlLabel('Current Status:') self.current_status = ControlLabel( time.strftime('%Y-%m-%d %H:%M', time.localtime(time.time())) + ' Program is not running...' + ' ' * 10) self.button = ControlButton('OK') self.button.value = self.button_action self.set_margin(15) self.formset = [{ 'Daily Report': ['daily_report'], 'Fund List': ['current_fund', ('fund_code', 'fund_amount'), 'add_fund_button'], 'Settings': [('sender_address', 'sender_password'), 'receiver_address', ('current_status_label', 'current_status'), 'button'] }]
def __init__(self): super(SimpleExample1, self).__init__("FaceGate") # self.visible = True self.set_margin(300) self.formset = [('_firstname', '_middlename', '_lastname'), '_button', '_fullname', ' _image', ' '] # self.formset = [ { # 'Tab1':['_firstname','||','_middlename','||','_lastname'], # 'Tab2': ['_fullname'] # }, # '=',(' ','_button', ' ') ] #Use dictionaries for tabs #Use the sign '=' for a vertical splitter #Use the signs '||' for a horizontal splitter #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._image = ControlImage() self.run()
def build(self): # Definition of the forms fields # self._mouseWeight = ControlText(label="Current weight for {}:") self._mouse_name = ControlLabel( f"Subject: {self.session_dict['mouse_name']}") self._mouse_projects = ControlLabel( f"Projects: {self.session_dict['mouse_projects']}") if len(self.session_dict["mouse_projects"]) > 1: self._mouse_project = ControlText( label="Latest project:", default=ast.literal_eval( self.session_dict["mouse_projects"])[0], ) elif len(self.session_dict["mouse_projects"]) == 1: self._mouse_project = ControlLabel( f"Selected project: {list(self.session_dict['mouse_projects'])[0]}" ) elif len(self.session_dict["mouse_projects"]) < 1: self._mouse_project = ControlLabel( f"Selected project: {self.session_dict['mouse_projects']}") self._mouse_weight = ControlText( label=f"Current weight for {self.session_dict['mouse_name']}:") self._session_is_mock = ControlText( label="Is this a MOCK session?", default=self.session_dict["session_is_mock"], ) self._session_index = ControlText( label="Session number:", default=str(int(self.session_dict["session_index"]) + 1), ) self._session_delay = ControlText( label="Delay session initiation by (min):", default=self.session_dict["session_delay"], ) self._button = ControlButton("Submit") # Define the organization of the forms self.formset = [ (" ", " ", " "), ("_mouse_name"), ("_mouse_projects"), ("_mouse_project"), ("_mouse_weight"), ("_session_is_mock"), ("_session_index"), ("_session_delay"), (" ", " ", " "), (" ", "_button", " "), (" ", " ", " "), ] # The ' ' is used to indicate that a empty space should be placed at the bottom of the win # If you remove the ' ' the forms will occupy the entire window # Define the button action self._button.value = self.__buttonAction self.form_data: dict = {}
def __init__(self): super(SimpleExample1, self).__int__('Simple example 1') self._firstname = ControlText('First name', 'Default value') self._middlename = ControlText('Middle name') self._lastname = ControlText('Last name') self._fullname = ControlText('Full name') self._button = controlButton('Press this button')
def __init__(self, parent): super(AddLoc, self).__init__('AddLoc') self._name = ControlText('Team Name') self._local = ControlDir('Local Folder') self._remote = ControlText('GDrive Folder-id') self._buttonfield = ControlButton('Create') self.parent = parent self._buttonfield.value = self._buttonfieldAction
def __init__(self): super(SimpleExample1,self).__init__('Simple example 1') #Definition of the forms fields self.start_date = ControlText('Start Date', default=datetime.now().strftime("%Y-%m-01")) self.end_date = ControlText('End Date', default=datetime.now().strftime("%Y-%m-%d")) self.license_plate = ControlText('License Plates', default='UN11316,UN11316,UN11316') self._button = ControlButton('Press this button') self.i = 1 self._button.value = self.__buttonAction
def __init__(self, client: Client): BaseWidget.__init__(self, 'Login') # Definition of the forms fields self._client = client self._nameField = ControlText("Name:") self._surnameField = ControlText("Surname:") self._peselField = ControlText("PESEL:") self._passwordField = ControlPassword("Password:"******"Confirm password:"******"Register") # Define the button action self._registerButton.value = self._registerAction
def __init__(self): super(AppFormatFullname, self).__init__('Format Fullname') # Definition of the forms fields self._firstname = ControlText('First name') self._lastname = ControlText('Lastname name') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') self._button.value = self.__buttonAction self.formset = [('_firstname', '_lastname'), '_button', '_fullname', ' ']
def __init__(self): super(SimpleExample1, self).__init__('Simple example 1') #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') #Define the button action self._button.value = self.__buttonAction
def __init__(self): super().__init__() self.name = ControlText('Name: ') self.surname = ControlText('Surname: ') self.address = ControlText('Address: ') self.description = ControlTextArea('Write your issue here: ') self.submit = ControlButton('Submit') self.formset = [ 'name', 'surname', 'address', 'description', '=', 'submit' ]
def __init__(self, *args, **kwargs): super().__init__('Capsification Automator') self._input_string = ControlText('Sentence to Capsify') self._output_string = ControlText('Capsified Sentence') self._run_button = ControlButton('Perform Capsification') self._run_button.value = self.__runButtonAction self._formset = [ '_input_string', '_run_button', '_output_string', ]
def _set_all_field_creator_ctrls(self): """ Sets all required controls for adding ne parameter Returns ------- """ self.param_name_ctrl = ControlText( ) # 'Name of desired field/cfg/variable') self.allwd_vals_ctrl = ControlText( ) # 'Allowed options for created field') self.default_val_ctrl = ControlText( ) # 'Default value of the created field') self.tooltip_ctrl = ControlText() # 'Desired tooltip to be shown')
def __init__(self): super(Main, self).__init__('Snake Machine Learning') self.selection_rate = ControlText("Selection Rate (0.001-0.999)", default="0.1") self.mutation_rate = ControlText("Mutation Rate (0.001-0.999)", default="0.01") self.population_size = ControlText("Population Size (20-1000)", default="100") self.random_weight_range = ControlText( "Random Weight Range (0.1 - 1.0)", default="1.0") self.max_generations = ControlText("Max Generations (1 - ...)", default="100") self.show_graphics = ControlCheckBox("Show Graphics", default=True) self.games_to_show = ControlText("Games to Show", default="25") self.grid_count = ControlText("Grid Count", default="30") self.grid_size = ControlText("Grid Size", default="5") self.save_population = ControlCheckBox("Save Population") self.save_best = ControlCheckBox("Save Best") self.save_graph = ControlCheckBox("Save Graph", default=True) self.error = ControlLabel("") self.start_button = ControlButton('Start Simulation') self.start_button.value = self.start_simulation self.formset = [ 'h1:Snake Machine Learning', 'h3:Machine Learning Parameters', 'selection_rate', 'mutation_rate', 'population_size', 'random_weight_range', 'max_generations', 'h3:Graphics Parameters', 'show_graphics', 'games_to_show', 'grid_count', 'grid_size', 'h3:Save Parameters', ('save_population', 'save_graph', 'save_best'), 'error', 'start_button' ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._addcategory_btn = ControlButton( '<i class="icon plus" ></i>Category', css='basic mini', field_css='five wide', label_visible=False, default=self.__create_new_category, ) self._category = ControlText('New category', field_css='eleven wide', label_visible=False, visible=False)
def __init__(self): super(HomeExample, self).__init__("My Home Window") self._firstName = ControlText("First name", "Kevin") self._lastName = ControlText("Last name", "Herrarte") self._email = ControlText("E-mail", "*****@*****.**") self._button = ControlButton("Ok!") self.formset = [{ '1) Personal Information': ['_firstName', '||', '_lastName'], '2) Contacts': ['_email'] }, '=', (' ', '_button', ' ')]
def __init__(self, user=None, connection=None, timestamp='', symbol='', price='', message='', flag='', key=''): super(NotificationWidget, self).__init__(timestamp, symbol, price, message, key) BaseWidget.__init__(self, 'Notification') self._user = user self._connection = connection if timestamp != '': self._timestamp_field = ControlLabel(timestamp) else: ts = datetime.now().timestamp() self._timestamp_field = ControlLabel( datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')) self._symbol_field = ControlText('Company Symbol') self._price_field = ControlText('Current Price (Optional)') self._message_field = ControlTextArea('Advisory') if symbol != '': self._symbol_field.value = symbol if price != '': self._price_field.value = price if message != '': self._message_field.value = message if flag == 'new': self._sendButton = ControlButton('Send') self._sendButton.value = self.__sendNotification elif flag == 'view': self._sendButton = ControlButton('Close') self._sendButton.value = self._close elif flag == 'edit': self._sendButton = ControlButton('Save') self._sendButton.value = self.__sendUpdate else: self._sendButton = ControlButton('Close') self._sendButton.value = self._close self._formset = [ ' ', ('||', '_timestamp_field', '||', ' '), ('||', '_symbol_field', '||', ' '), '=', ('||', '_price_field', '||', ' '), ('||', '_message_field', '||'), ('||', '_sendButton', '||') ]
def __init__(self, *args, **kwargs): super().__init__('Computer vision algorithm example') # Definition of the forms fields self._videofile = ControlFile('Video Link') self._outputfile = ControlText('Results output file') # self._threshold = ControlSlider('Threshold', default=114, minimum=0, maximum=255) # self._blobsize = ControlSlider('Minimum blob size', default=110, minimum=100, maximum=2000) # self._player = ControlPlayer('Player') self._runbutton = ControlButton('Run') # Define the function that will be called when a file is selected self._videofile.changed_event = self.__video_file_selection_event # Define the event that will be called when the run button is processed self._runbutton.value = self.run_event # Define the event called before showing the image in the player self._player.process_frame_event = self.__process_frame # Define the organization of the Form Controls self._formset = [ ('_videofile', '_outputfile'), # '_threshold', # ('_blobsize', '_runbutton'), # '_player' ]
def __init__(self, timeline=None): super(Graph2Event, self).__init__('Graph to event', parent_win=timeline) self.setContentsMargins(10, 10, 10, 10) self._timeline = timeline # Definition of the forms fields self._graphs_list = ControlList('Graphs list (try double click)') self._equation = ControlTextArea('Equation') self._eventname = ControlText('Event name', 'New event') self._rownumber = ControlNumber('Row number', 0, 0, 1000) self._mindiff = ControlNumber('Minimum of frames', 0, 0, 1000000) self._genevts_btn = ControlButton('Generate events') self._formset = [ (['_graphs_list'], '||', [ ('_eventname', '_rownumber', '_mindiff'), '_equation', '_genevts_btn', ]), ] self._graphs_list.cell_double_clicked_event = self.__cell_double_clicked_evt self._graphs_list.readonly = True self._graphs_list.select_entire_row = True self._genevts_btn.value = self.__generage_events_evt
def __init__(self, project=None): BaseWidget.__init__(self, 'Task') self.layout().setContentsMargins(5, 10, 5, 5) self.precmdwin = None self.postcmdwin = None self._namefield = ControlText('Task name', changed_event=self.__name_edited_evt) self._use_server = ControlCheckBox('Trigger soft codes using a UDP port') self._precmds = ControlList( 'Pre commands', add_function=self.__add_pre_command, remove_function=self.__remove_pre_command, readonly=True ) self._postcmds = ControlList( 'Post commands', add_function=self.__add_post_command, remove_function=self.__remove_post_command, readonly=True ) self._formset = [ '_namefield', '_use_server', '_precmds', '_postcmds', ' ' ] Task.__init__(self, project) self.update_commands()
def _widgets(self): """Insight GUI items for operation and status display""" # Action and error log from parent Controller class Controller._widgets(self) # Emission and shutter operation self.emission_button = ControlButton('Laser Off') self.emission_button.value = self._emission self.main_shutter_button = ControlButton('Main Shutter Closed') self.main_shutter_button.value = self._main_shutter_control self.fixed_shutter_button = ControlButton('1040 nm Shutter Closed') self.fixed_shutter_button.value = self._fixed_shutter_control # OPO Tuning self.tune_wl_val = ControlText('Set Wavelength (nm):') self.tune_wl_button = ControlButton('Set') self.tune_wl_button.value = self._tune_wl self._main_wl_label = ControlLabel('Main Wavelength (nm): %s' \ % str(self.opo_wl)) # Define statistics displays self._stats_labels() self._state_label = ControlLabel('%s' % (self.state)) # Stored buffer with fault codes self._code_history = ControlTextArea('Status Buffer History') self._code_history.readonly = True
def __init__(self, project): # type: (Project) -> None """ :param project: project where this experiment belongs :type project: pycontrolgui.models.project.Project """ BaseWidget.__init__(self, 'Experiment') self.layout().setContentsMargins(5, 10, 5, 5) self._name = ControlText('Exp. name') # self._task = ControlCombo('Protocol', changed_event=self.__task_changed_evt) self._runsetup = ControlButton('Run all') self._formset = [ '_name', # '_task', '_runsetup', ' ' ] Experiment.__init__(self, project) # self.reload_tasks() self._name.changed_event = self.__name_changed_evt self._runsetup.value = self.__run_all
def __init__(self, *args, **kwargs): super().__init__("Gateway Helper") self.set_margin(20) if getattr(sys, 'frozen', False): self.application_path = os.path.dirname(sys.executable) elif __file__: self.application_path = os.path.dirname(__file__) # cwd = os.getcwd() self.cwd = self.application_path # print() # print(cwd) # print() # self.cartsDir = os.path.join(self.cwd, "Carts") os.environ["PATH"] += os.pathsep + self.cwd self._vendor = ControlText('Vendor (Use exactly what Gateway does)') self._cart = ControlFile('Cart Excel File') self._runbutton = ControlButton('Run') self._cancelbutton = ControlButton('Cancel') self._vendor.changed_event = self.__vendorSelectEvent self._cart.changed_event = self.__cartSelectEvent self._runbutton.value = self.__runEvent self._cancelbutton.value = self.__cancelEvent self._formset = [('_vendor'), '_cart', ("_runbutton", '_cancelbutton')] self.fileOkay = False self.vendorOkay = False self.df = pd.DataFrame()
def __init__(self): # print("it is running") super(Window_1, self).__init__('window 1') # print("it is running") #self.second_window = Window_2() self.day_current = 1 self.controller = master.Controller() self.graph_button = ControlButton("show the graph") self.days = ControlText('how many days have passed') self.random_event_button = ControlButton('enter') self.save_population_button = ControlButton('save the population') self.other_window_button = ControlButton('other window') self.graph_button.value = self.make_graph #utils.send_to_plot(self.controller.populationBlocks)) self.random_event_button.value = self.call_random_event self.save_population_button.value = self.controller.saveBlocks self.other_window_button.value = self.open_other_window #self.label = ControlTextArea(utils.labelgraphPrint(self.controller.populationBlocks, [-10,10,-10,10]), font_size=14) #self.timeline = ControlEventTimeline("timeline1") #BaseWidget.generate_tabs(dictionary) self.mainmenu = [{ 'File': [{ 'exit': exit() }, { 'test1': self.__buttonAction() }] }]
def _set_sect_creat_ctrls(self): ctrl_txt = ControlText() self.ctrld_w.section_name_ctrl = ctrl_txt appld_stylesheet = \ 'QGroupBox {' \ 'font-size: 16px;'\ 'font: Calibri;}'\ 'QGroupBox:title {'\ 'subcontrol-origin: margin;'\ 'subcontrol-position: top center;'\ 'padding-left: 10px;'\ 'padding-right: 10px;'\ 'padding-top: 12px; }' # grpbox_desc: str, grpbox_stylesheet: str, # main_grpbox_ctrl: ControlBase, return_container: bool = True self.ctrld_w.section_name_ctrl_grpbox = get_pyqt_grpbox( grpbox_desc='Please provide the name of the new section', grpbox_stylesheet=appld_stylesheet, main_grpbox_ctrl=ctrl_txt) self.ctrld_w.section_name_ctrl_grpbox.form.setMinimumWidth(600) # set cancel button self.ctrld_w.cancel_butt = ControlButton() self.ctrld_w.cancel_butt.label = 'Cancel' self.ctrld_w.cancel_butt.value = self.ctrld_w.form.close set_sect_btn = CFGSectionCreatorButton(cfg_sect_creat_ctrl=self) self.ctrld_w.set_section_butt = set_sect_btn # ControlButton()
def __init__(self, checkedList): Player.__init__(self, '', '', '') BaseWidget.__init__(self, 'Add New Player') # Init local vars self.__checked = checkedList # Init UI Elements self._txtPlayerName = ControlText('Player Name') self._cboCharacterName = ControlCombo('Character Name') self._cboStarterDeck = ControlCombo('Starter Deck') self._btnAddPlayer = ControlButton('Add Player') # Set up properties of UI elements, attach callbacks, etc. self._btnAddPlayer.value = self.__onAddPlayerClick # Populate Character Names and Starter Decks characters = loader.getFilteredList(MBType.CHARACTER, self.__checked) decks = loader.getFilteredList(MBType.STARTER, self.__checked) for char in characters: self._cboCharacterName.add_item(char, char) for deck in decks: self._cboStarterDeck.add_item(deck, deck) # set up flow of components self.formset = [ '_txtPlayerName', '_cboCharacterName', '_cboStarterDeck', '_btnAddPlayer' ]