def __init__(self): BaseWidget.__init__(self, "Help - RIST-ng") self.Github = ControlTextArea("") self.Github.value = """ URL target methods are prefixed with 'u_' Domain target methods are prefixed with 'd_' IP target methods are prefixed with 'i_' The number on the end after the semicolon (:) defines button behavior in relation to the target method: 0 None 1 Min will trigger 2 Full will trigger 3 Both will trigger RIST-ng Options: browser - browser to use in simple cases (typically when GET request) - Opens in new TAB selenium - browser to use for visit automation (typically when POST request) - Opens in new WINDOW always_on_top - (currently unimplimented) - RIST-ng window stays on top: 0=off, 1=on Options for "browser": %s Options for "selenium" automated queries: %s """ % (''.join(["%s=%s\n" % (x, y) for x, y in BROWSERS.items()]), ''.join( ["%s=%s\n" % (x, y) for x, y in SELENIUMS.items()]))
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, parent=None, parentWindow=None): BaseWidget.__init__(self, 'Events stats', parentWindow=parentWindow) 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.setMinimumWidth(800) self.setMinimumHeight(600)
def __init__(self): BaseWidget.__init__(self, "Money") self.set_margin(10) self.formset = [] self.formset.append('Monthly Income: ') revenue, revenues = university.calcRevenue() expense, expenses = university.calcExpense() income = revenue + expense if income >= 0: self.formset.append((' ', '+ $' + str(income))) else: self.formset.append((' ', '- $' + str(-income))) self.formset.append('Revenues: ') self.formset.append((' ', '+$' + str(revenue))) r = 3 for rev in revenues: self.formset.append((rev.description, ' ', '+$' + str(rev.value))) r += 1 self.formset.append('Expenses: ') self.formset.append((' ', '-$' + str(-expense))) r += 1 i = 0 for exp in expenses: self.formset.append((exp.description, ' ', '-$' + str(-exp.value))) r += 1
def __init__(self): BaseWidget.__init__(self, 'Video window') self._player = ControlPlayer('Player') self.formset = ['_player']
def __init__(self): BaseWidget.__init__(self, "RIST-ng v%s \"%s\"" % (Version, Codename)) self._show_project() self.formset = [('_IoC', '_min', '_full', '_settings'), ' '] self._IoC = ControlText("IoC: ") self._min, self._min.value = ControlButton("Min"), self._minACTION self._full, self._full.value = ControlButton("Full"), self._fullACTION self._settings, self._settings.value = ControlButton( "Settings"), self._settingsACTION
def __init__(self): People.__init__(self) BaseWidget.__init__(self,'People window') #Definition of the forms fields self._peopleList = ControlList('People', plusFunction = self.__addPersonBtnAction, minusFunction = self.__rmPersonBtnAction) self._peopleList.horizontalHeaders = ['First name', 'Middle name', 'Last name']
def __init__(self): BaseWidget.__init__(self, 'SoundBoard') # self._panel = ControlEmptyWidget('Song title') # self._playbutton = ControlButton('Play/Pause') # self._stopbutton = ControlButton('Stop') slot = SoundSlot() slot._parent = self slot.show()
def __init__(self): People.__init__(self) BaseWidget.__init__(self, "People window") # Definition of the forms fields self._peopleList = ControlList( "People", plusFunction=self.__addPersonBtnAction, minusFunction=self.__rmPersonBtnAction ) self._peopleList.horizontalHeaders = ["First name", "Middle name", "Last name"]
def __init__(self, isCreating): Client.__init__(self, '', '') BaseWidget.__init__(self, 'Client') self.__isCreating = isCreating self._idField = ControlText("Id") if not isCreating: self._idField.enabled = False self._nameField = ControlText("Name") self._buttonField = ControlButton('Add a new client') self._buttonField.value = self._updateAction self._label = ControlLabel("")
def __init__(self): BaseWidget.__init__(self, "Mandelbrot Set Generator") self._redSlider = ControlSlider(label="Red", min=0, max=255) self._blueSlider = ControlSlider(label="Blue", min=0, max=255) self._greenSlider = ControlSlider(label="Green", min=0, max=255) self._redSliderTwo = ControlSlider(label="Red 2", defaultValue=255, min=0, max=255) self._blueSliderTwo = ControlSlider(label="Blue 2", defaultValue=255, min=0, max=255) self._greenSliderTwo = ControlSlider(label="Green 2", defaultValue=255, min=0, max=255) self._randomizeFirstColor = ControlCheckBox(label='Randomize First Color?') self._randomizeFirstColor.value = True self._randomizeSecondColor = ControlCheckBox(label="Randomize Second Color?") self._randomizeSecondColor.value = True self._randomizeBrightness = ControlCheckBox(label="Randomize Brightness?") self._brightnessSlider = ControlSlider(label="Brightness", defaultValue=255, min=0, max=255) self._xSlider = ControlText(label="X", defaultValue="-1.0") self._ySlider = ControlText(label="Y", defaultValue="0") self._zoomSlider = ControlNumber(label="Zoom", defaultValue=1, min=1, max=1000000) self._entropySlider = ControlSlider(label="Entropy", defaultValue=5000, min=100, max=100000) self._randomPreviewButton = ControlButton(label="Smart Randomize and Generate Preview") self._randomPreviewButton.value = self.randomPreviewAction self._previewButton = ControlButton(label="Generate Preview (120x120)") self._previewButton.value = self.previewAction self._generateButton = ControlButton(label="Generate (500x500)") self._generateButton.value = self.generateAction self._exportButton = ControlButton(label="Export For Desktop (2049x1153)") self._exportButton.value = self.exportAction self._fourKExportButton = ControlButton(label="Export at 4K UHD (3840x2160)") self._fourKExportButton.value = self.fourKExportAction self._phoneExportButton = ControlButton(label="Export for Phone (1080x1920)") self._phoneExportButton.value = self.phoneExportAction self._randomButton = ControlButton(label="Randomize") self._randomButton.value = self.randomAction self._formset = [ (('_redSlider', '_greenSlider', '_blueSlider'),"=", ('_redSliderTwo', '_greenSliderTwo', '_blueSliderTwo'), '=', ' ', '_randomizeFirstColor', '_randomizeSecondColor', '_randomizeBrightness', '|', '_brightnessSlider', "=", '_entropySlider', '_xSlider', '_ySlider', '_zoomSlider', "=", '_randomButton', '_randomPreviewButton', '_previewButton', '_generateButton', '_exportButton', '_fourKExportButton', '_phoneExportButton') ]
def __init__(self): # Begin making the GUI shown when this sensor is selected self._widget = BaseWidget() self._widget.threshold = ControlSlider(label="Threshold", default=18, min=0, max=255) self._widget.threshold.changed_event = self._update_params self._widget.min_size = ControlSlider( label="Minimum Size", default=50, min=0, max=200, ) self._widget.min_size.changed_event = self._update_params self._widget.sample_radius = ControlSlider(label="Sample Radius", default=17, min=0, max=200) self._widget.sample_radius.changed_event = self._update_params self._widget.show_button = ControlButton(label="Show Camera") self._widget.show_button.value = self._show_camera self._widget.before_close_event = self._hide_camera
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): self._camera = ThorlabsDCx() self._measuring = False # Begin making the GUI shown when this sensor is selected self._widget = BaseWidget() self._widget.threshold = ControlSlider(label="Threshold", default=18, min=0, max=255) self._widget.min_size = ControlSlider( label="Minimum Size", default=50, min=0, max=200, ) self._widget.sample_radius = ControlSlider(label="Sample Radius", default=17, min=0, max=200) self._widget.show_button = ControlButton(label="Show Camera") self._widget.show_button.value = self._show_camera self._widget.before_close_event = self._hide_camera self._timer.timeout.connect(self._get_frame)
def __init__(self): # Begin making the GUI shown when this sensor is selected self._widget = BaseWidget() self._widget.threshold = ControlSlider( label="Threshold", default=18, min=0, max=255 ) self._widget.threshold.changed_event = self._update_params self._widget.min_size = ControlSlider( label="Minimum Size", default=50, min=0, max=200, ) self._widget.min_size.changed_event = self._update_params self._widget.on_threshold = ControlSlider( label="Frequency Threshold", default=17, min=0, max=255 ) self._widget.on_threshold.changed_event = self._update_params self._widget.x_bounds_label = ControlLabel( label="X Bounds" ) self._widget.x_bounds = ControlBoundingSlider( label="X Bounds", default=[0, 640], min=0, max=640, horizontal=True ) self._widget.x_bounds.convert_2_int = True self._widget.x_bounds.changed_event = self._update_params self._widget.y_bounds_label = ControlLabel( label="Y Bounds" ) self._widget.y_bounds = ControlBoundingSlider( label="Y Bounds", default=[0, 512], min=0, max=512, horizontal=True ) self._widget.y_bounds.convert_2_int = True self._widget.y_bounds.changed_event = self._update_params self._widget.save_background = ControlButton( label="Save background" ) self._widget.save_background.value = self._save_background
def __init__(self): BaseWidget.__init__(self, "AM | Program") # Initialize the programming GUI self._eventList = ControlList(label="Events") self._addEvent = ControlButton("Add Event") self._deleteEvent = ControlButton("Delete Event") self._saveButton = ControlFile("Save Program") self._loadButton = ControlFile("Load Program") self._addEvent.value = self.addEventAction self._deleteEvent.value = self.deleteEventAction self._formset = [ '_eventList', '=', ('_addEvent','_deleteEvent', '_saveButton', '_loadButton') ] # Done creating things. Now to get the list working ####################################################################################################### # LIST CONVENTION: "Name", bpm, timesignum, timesigdenom, subdiv, measures wait, beats to spread over # ####################################################################################################### self._eventList.horizontalHeaders=["Name", "BPM", "(TS) Beats", "(TS) Beat Value", "Subdivision", "Measure to Change On", "Time to Change (Beats)"] # First step is to add the initial Event self._eventList.value = [['InitialEvent', 120, 4, 4, 1, 1, 0]] Globals.globalEventList = [['InitialEvent', 120, 4, 4, 1, 1, 0]] global updateGlobalsThread updateGlobalsThread = threading.Thread(name='updateGlobalsThread', target=Programming.updateGlobals, args=(self,)) updateGlobalsThread.setDaemon(True) updateGlobalsThread.start() global saveButtonListenerThread saveButtonListenerThread = threading.Thread(name='saveButtonListenerThread', target=Programming.saveButtonListener, args=(self,)) saveButtonListenerThread.setDaemon(True) saveButtonListenerThread.start() global loadButtonListenerThread loadButtonListenerThread = threading.Thread(name='loadButtonListenerThread', target=Programming.loadButtonListener, args=(self,)) loadButtonListenerThread.setDaemon(True) loadButtonListenerThread.start()
def __init__(self): Person.__init__(self, '', '', '') BaseWidget.__init__(self,'Person window') self.parent = None #Definition of the forms fields self._firstnameField = ControlText('First name') self._middlenameField = ControlText('Middle name') self._lastnameField = ControlText('Lastname name') self._fullnameField = ControlText('Full name') self._buttonField = ControlButton('Press this button') #Define the button action self._buttonField.value = self.buttonAction self._formset = ['_firstnameField', '_middlenameField', '_lastnameField', '_fullnameField', (' ','_buttonField', ' '), ' ']
def __init__(self, formset, title='Controller'): BaseWidget.__init__(self, title) self.set_margin(10) # GUI widgets self._widgets() # GUI Organization self.formset = formset # Record initiliazation self._update_history() # Status query threading self.queryThread = threading.Thread(name='%s Query Thread' % (title), target=self._status) self.queryThread.daemon = True self.queryThread.start()
def __init__(self): global OBJS global WORKING_SET global WORKING_OPT BaseWidget.__init__(self, "Settings") self.formset = [('_user_settings'), ('_user_options', ), ('_help', '_save'), ' '] self._user_settings = ControlTextArea( "") # reputation source functions and Min,Full settings self._user_options = ControlTextArea("") # options # self._browser_help = ControlTextArea("",readonly=True, autoscroll=False) self._help, self._help.value = ControlButton("Help"), self._helpACTION self._save, self._save.value = ControlButton("Save"), self._saveACTION for name, setting in OBJS: self._user_settings.__add__("%s:%s" % (name, setting)) for name, setting in OPTS.items(): self._user_options.__add__("%s:%s" % (name, setting)) self.__config__()
def __init__(self): Person.__init__(self, '', '', '') BaseWidget.__init__(self, 'Person window') self.parent = None #Definition of the forms fields self._firstnameField = ControlText('First name') self._middlenameField = ControlText('Middle name') self._lastnameField = ControlText('Lastname name') self._fullnameField = ControlText('Full name') self._buttonField = ControlButton('Press this button') #Define the button action self._buttonField.value = self.buttonAction self.formset = [ '_firstnameField', '_middlenameField', '_lastnameField', '_fullnameField', (' ', '_buttonField', ' '), ' ' ]
def __init__(self, parent_win, label, begin, end): BaseWidget.__init__(self, 'Edit frame', parent_win=parent_win) self.set_margin(5) self._label = ControlText('Label', default=label) self._begin = ControlNumber('Begin', default=begin, minimum=0, maximum=100000000000000) self._end = ControlNumber('End', default=end, minimum=0, maximum=100000000000000) self._applybtn = ControlButton('Apply') self.formset = ['_label', ('_begin', '_end'), '_applybtn'] self._begin.changed_event = self.__begin_changed_event self._end.changed_event = self.__end_changed_event
def __init__(self, clientController, rentalController): # Client.__init__(self, R) BaseWidget.__init__(self, 'Client') # Definition of the forms fields2 self._clientList = ControlList('Clients', plusFunction=self.__addClientBtnAction, minusFunction=self.__removeClientBtnAction) self.__controller = clientController self._searchInput = ControlText("Search") self._searchButton = ControlButton("Go") self._formset = [ ('_searchInput', ('_searchButton')), ("_clientList") ] self._searchButton.value = self.searchData self.__rentalController = rentalController data = [[x.id, x.name] for x in self.__controller.getAllClients()] self._clientList.value += data self._clientList.selectEntireRow = True self._clientList.readOnly = True self._clientList.horizontalHeaders = ['Id', 'Name'] self._clientList.cellDoubleClicked = self.updateClientAction
def __init__(self, movieController, rentalController): # MovieController.__init__(self, R) BaseWidget.__init__(self, 'Movie') # Definition of the forms fields2 self._searchInput = ControlText("Search") self._searchButton = ControlButton("Go") self._formset = [ ('_searchInput', ('_searchButton')), ("_movieList") ] self._movieList = ControlList('Movies', plusFunction=self.__addPersonBtnAction, minusFunction=self.__removeMovieBtnAction) self.__controller = movieController self.__rentalController = rentalController data = [[x.id, x.title, x.description, x.genre] for x in self.__controller.getAllMovies()] self._movieList.value += data self._movieList.selectEntireRow = True self._movieList.readOnly = True self._movieList.horizontalHeaders = ['Id', 'Title', 'Description', 'Genre'] self._movieList.cellDoubleClicked = self.updateMovieAction self._searchButton.value = self.searchData
def __init__(self, isCreating): Rental.__init__(self, '', '', '', '', '', '') BaseWidget.__init__(self, 'Rental') self.__isCreating = isCreating self._idField = ControlText("Id") self._clientIdField = ControlText("Client Id") self._movieIdField = ControlText("Movie Id") self._dueDateField = ControlText("Due Date") self._rentedDateField = ControlText("Rented Date") self._returnedDateField = ControlText("Returned Date") self._buttonField = ControlButton('Rent a new Movie') self._buttonField.value = self._updateAction self._rentedDateField.enabled = False self._returnedDateField.enabled = False self._label = ControlLabel("") if not isCreating: self._idField.enabled = False self._clientIdField.enabled = False self._movieIdField.enabled = False self._dueDateField.enabled = False self._returnedDateField.enabled = False self._rentedDateField.enabled = False self._buttonField.value = self.returnMovie self._buttonField.name = "Return movie"
def __init__(self, parent_win, label, begin, end): BaseWidget.__init__(self, 'Edit frame', parent_win=parent_win) if conf.PYFORMS_USE_QT5: self.layout().setContentsMargins(5, 5, 5, 5) else: self.layout().setMargin(5) self._label = ControlText('Label', default=label) self._begin = ControlNumber('Begin', default=begin, minimum=0, maximum=100000000000000) self._end = ControlNumber('End', default=end, minimum=0, maximum=100000000000000) self._applybtn = ControlButton('Apply') self.formset = ['_label', ('_begin', '_end'), '_applybtn'] self._begin.changed_event = self.__begin_changed_event self._end.changed_event = self.__end_changed_event
def __init__(self): self._labjack = ljm.openS("T7", "USB", "ANY") self._serial_number = ljm.eReadName(self._labjack, 'SERIAL_NUMBER') # Start making the GUI to display when this sensor is selected self._widget = BaseWidget() # Label to show the serial number of the Labjack self._widget.serial_number = ControlLabel() self._widget.serial_number.value = str(int(self._serial_number)) # Number input to get the threshold for an 'on' signal # for frequency calculations self._widget.threshold = ControlNumber(label="Threshold", default=0.1, minimum=0, maximum=float('inf'), decimals=5)
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 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, name, iconFile=None): if not iconFile: iconFile = tools.getFileInSameDirectory(__file__, "question.png") BaseWidget.__init__(self, name) OTModuleWorkFlowItem.__init__(self, name, iconFile=iconFile)
def __init__(self): Person.__init__(self, '', '', '') BaseWidget.__init__(self, 'Person Window') #super(SimpleExample1,self).__init__('Simple example 1') #Definition of the forms fields self.mainmenu = [ { 'File': [ {'Open': self.__dummyevent}, '-', {'Save': self.__dummyevent}, {'Save as': self.__dummyevent} ] }, { 'Settings': [ {'Workplaces': self.__openWork}, {'Employees': self.__openemployees} ] self._firstname = ControlText('First name', 'John') self._lastname = ControlText('Last name', 'Doe') self._fullname = ControlText('Full name') self._button = ControlButton('Press this button') self._alldays = ControlCheckBox('All days') self._alldays.changed_event = self.__alldaysAction self._days = ControlCheckBoxList('Days') self._days += ('Monday', True) self._days += ('Tuesday', True) self._days += ('Wednesday', True) self._days += ('Thursday', True) self._days += ('Friday', True) self._days += ('Saturday', True) self._days += ('Sunday', True) self._allshifts = ControlCheckBox('All shifts') self._allshifts.changed_event = self.__allshiftsAction self._shifts = ControlCheckBoxList('Shifts') self._shifts += ('Mornings', True) self._shifts += ('Evenings', True) self._shifts += ('Nights', True) self._alljobs = ControlCheckBox('All positions') self._alljobs.changed_event = self.__alljobsAction self._jobs = ControlCheckBoxList('Positions') self._jobs += ('Cashier', True) self._jobs += ('Stocker', True) self._jobs += ('Deli', True) self._button.value = self.__buttonAction self._testbox = ControlText() def __openjobs(self): self._testbox.hide() def __buttonAction(self): """Button action event""" self._fullname.value = self._firstname.value + " " + self._middlename.value + \ " " + self._lastname.value if self.parent!=None: self.parent.addPerson(self) def __alldaysAction(self): self._testbox.show() def __allshiftsAction(self): self._testbox.hide() def __alljobsAction(self): self._testbox.hide() class SimpleExample2(BaseWidget): def __init__(self): super(SimpleExample2,self).__init__('Simple example 2') self._secondname = ControlText('Second name', 'Hello') self._secondmiddlename = ControlText('Second middle name') self._secondlastname = ControlText('Second last name') self._secondfullname = ControlText('Second full name') self._secondbutton = ControlButton('Press this button plz') def __alljobsActions(self): self._textbox.hide() if __name__ == "__main__": pyforms.start_app( PersonWindow ) #if __name__ == "__main__": pyforms.start_app( SimpleExample2 )
def save(self, saver): """ OTModule.saveContent reimplementation """ BaseWidget.save(self, saver) OTModuleWorkFlowItem.save(self, saver)
def __init__(self): BaseWidget.__init__(self, "Mandelbrot Set Generator") self._redSlider = ControlSlider(label="Red", min=0, max=255) self._blueSlider = ControlSlider(label="Blue", min=0, max=255) self._greenSlider = ControlSlider(label="Green", min=0, max=255) self._redSliderTwo = ControlSlider(label="Red 2", defaultValue=255, min=0, max=255) self._blueSliderTwo = ControlSlider(label="Blue 2", defaultValue=255, min=0, max=255) self._greenSliderTwo = ControlSlider(label="Green 2", defaultValue=255, min=0, max=255) self._randomizeFirstColor = ControlCheckBox( label='Randomize First Color?') self._randomizeFirstColor.value = True self._randomizeSecondColor = ControlCheckBox( label="Randomize Second Color?") self._randomizeSecondColor.value = True self._randomizeBrightness = ControlCheckBox( label="Randomize Brightness?") self._brightnessSlider = ControlSlider(label="Brightness", defaultValue=255, min=0, max=255) self._xSlider = ControlText(label="X", defaultValue="-1.0") self._ySlider = ControlText(label="Y", defaultValue="0") self._zoomSlider = ControlNumber(label="Zoom", defaultValue=1, min=1, max=1000000) self._entropySlider = ControlSlider(label="Entropy", defaultValue=5000, min=100, max=100000) self._randomPreviewButton = ControlButton( label="Smart Randomize and Generate Preview") self._randomPreviewButton.value = self.randomPreviewAction self._previewButton = ControlButton(label="Generate Preview (120x120)") self._previewButton.value = self.previewAction self._generateButton = ControlButton(label="Generate (500x500)") self._generateButton.value = self.generateAction self._exportButton = ControlButton( label="Export For Desktop (2049x1153)") self._exportButton.value = self.exportAction self._fourKExportButton = ControlButton( label="Export at 4K UHD (3840x2160)") self._fourKExportButton.value = self.fourKExportAction self._phoneExportButton = ControlButton( label="Export for Phone (1080x1920)") self._phoneExportButton.value = self.phoneExportAction self._randomButton = ControlButton(label="Randomize") self._randomButton.value = self.randomAction self._formset = [ (('_redSlider', '_greenSlider', '_blueSlider'), "=", ('_redSliderTwo', '_greenSliderTwo', '_blueSliderTwo'), '=', ' ', '_randomizeFirstColor', '_randomizeSecondColor', '_randomizeBrightness', '|', '_brightnessSlider', "=", '_entropySlider', '_xSlider', '_ySlider', '_zoomSlider', "=", '_randomButton', '_randomPreviewButton', '_previewButton', '_generateButton', '_exportButton', '_fourKExportButton', '_phoneExportButton') ]
def __init__(self): Globals.init() # Initialize the Metronome GUI BaseWidget.__init__(self, "AutoMetronome") # Create the Settings GUI # Metronome Tab self._togglePause = ControlButton("Play/Pause", checkable=True) self._minusOne = ControlButton("-") self._addOne = ControlButton("+") self._togglePause.value = self.togglePauseAction self._minusOne.value = self.minusOneAction self._addOne.value = self.addOneAction # Settings Tab self._minTempoInput = ControlText(label="Minimum Tempo", defaultValue="30") self._maxTempoInput = ControlText(label="Maximum Tempo", defaultValue="255") self._timeSignatureNumeratorInput = ControlNumber(label="Time Signature:", defaultValue=4) self._timeSignatureDenominatorInput = ControlNumber(label="/",defaultValue=4) self._subdivisionInput = ControlNumber("Subdivisions per Beat:", defaultValue=1) self._tempoDividerSet = ControlCombo("Tempo Defined ") self._tempoDividerSet.addItem("In Full Value", value="quarter") self._tempoDividerSet.addItem("In Cut Time", value="half") self._tempoDividerSet.addItem("In One", value="one") self._tempoDividerSet.addItem("In Two", value="eighth") self._tempoDividerSet.addItem("By Dotted Eighth Note (for 6/8 or similar times)", value="eighth_dot") self._tempoDividerSet.addItem("By Dotted Quarter Note (for 6/8 or similar times)", value="quarter_dot") self._updateSettings = ControlButton("Save") self._updateSettings.value = self.updateSettingsAction # Programming Tab self._runProgram = ControlButton("Run Program") self._runProgram.value = self.runProgramAction self._loadProgram = ControlFile(label="Load Program") self._programmingPanel = ControlDockWidget() programmingWindow = Programming() programmingWindow.parent = self self._programmingPanel.value = programmingWindow # self._programmingPanel.hide() # End of UI creation global minTempo global maxTempo minTempo = int(self._minTempoInput.value) maxTempo = int(self._maxTempoInput.value) global timeSignatureNumerator global timeSignatureDenominator timeSignatureNumerator = int(self._timeSignatureNumeratorInput.value) timeSignatureDenominator = int(self._timeSignatureDenominatorInput.value) global subdivision subdivision = float(self._subdivisionInput.value) global tempoDivider global bpmMultiplier tempoDivider = self._tempoDividerSet.value bpmMultiplier = 1 self._metronomeStatusLabel = ControlLabel("Time Signature: "+str(timeSignatureNumerator)+"/"+str(timeSignatureDenominator)) self._metronomeSubdivLabel = ControlLabel("Subdivision: "+str(subdivision)) # Draw the metronome Metronome.drawMetronome(self) # Set layout self._formset = [ { 'Metronome': [('_tempoSlider', '_minusOne','_addOne'), ('_metronomeStatusLabel', '_metronomeSubdivLabel'),'=','_togglePause'], 'Settings': ['_minTempoInput', '_maxTempoInput',('_timeSignatureNumeratorInput', '_timeSignatureDenominatorInput'), '_subdivisionInput', '_tempoDividerSet','_updateSettings'], 'Programming':['_runProgram', '_loadProgram'], 'Vade Mecum':['Programming: \n The window is relatively self explanatory, \n but there are a few hidden details. If you name an Event \"STOP\", \n the program will automatically stop at the beginning of that measure.\n If you name an Event \"REPEAT\", you can put the Event number \n (first Event being \'1\') in the Beats column \n and the number of times to repeat in the BPM column. \n \n Saving/Loading: \n Saving a program happens automatically when you open a file \n in the Save Program window. There is no feedback \n to indicate this yet.'] }]
def load(self, loader): """ OTModule.loadSavedContent reimplementation """ OTModuleWorkFlowItem.load(self, loader) BaseWidget.load(self, loader)
def __init__(self, category, msg): BaseWidget.__init__(self, '%s' % (category)) self.msg = ControlLabel('%s' % (msg))