def __init__(self, timelineWidget=None): super(GraphsProperties, self).__init__('Graphs properties') self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min') self._max_value = ControlNumber('Max') self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Top position', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._formset = [ (['_graphs_list', '_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top', ' '), '_values_zoom', ' ' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes
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, timeline=None): super(GraphsEventsGenerator, self).__init__('Apply a function to the graph values', 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._graphname = ControlText('Graph name') self._genevts_btn = ControlButton('Generate graph') self._formset = [ (['_graphs_list'], '||', [ '_graphname', '_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, name, data): ControlList.__init__(self, name) self.horizontalHeaders = [ 'Id', 'Title', 'Description', 'Genre', 'Times' ] self.value = [[ x[0].id, x[0].title, x[0].description, x[0].genre, x[1] ] for x in data] self.selectEntireRow = True self.readOnly = True
def __init__(self, timelineWidget=None, parent_win=None): super(GraphsProperties, self).__init__('Graphs properties', parent_win=parent_win) self.setContentsMargins(10, 10, 10, 10) self._mainwindow = parent_win self._timeline = timelineWidget #self.setMaximumWidth(300) # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min', 0, -sys.float_info.max, sys.float_info.max) self._max_value = ControlNumber('Max', 0, -sys.float_info.max, sys.float_info.max) self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Bottom', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._value = ControlLabel() self._graphs_list.readonly = True self._formset = [ (['_graphs_list', '_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value', ' '), ('_values_top', ' '), '_values_zoom', 'info:Choose one graph and move the mouse over \nthe timeline to visualize the coordenates.', '_value' ]), ] self._graphs_list.select_entire_row = True self._graphs_list.item_selection_changed_event = self.__graphs_list_selection_changed self._loaded = False self._current_selected_graph = None self._name.changed_event = self.__save_graphs_changes self._min_value.changed_event = self.__save_graphs_changes self._max_value.changed_event = self.__save_graphs_changes self._values_zoom.changed_event = self.__save_graphs_changes self._values_top.changed_event = self.__save_graphs_changes self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False self._remove_graph_btn.value = self.__remove_chart
def __init__(self): super().__init__('Oogstlijst Manager') reference_list = Main.hl.reference_data self._list_left = ControlList('Stamlijst') self._list_left.readonly = True self._list_right = ControlList('Oogstlijst') self._list_right.select_entire_row = True self._list_right.horizontal_headers = [ 'Oogst', 'Hoeveelheid (kg)', ] self._save_button = ControlButton('Verder') self._save_button.value = self._continue self.formset = ['_list_left', '_list_right', '_save_button'] def onclick_left(row, column): r = self._list_left.get_currentrow_value() self._list_right.__add__(r + [0]) # cell = self._list_right.get_cell(0, self._list_right.rows_count - 1) # cell.setFlags(QtCore.Qt.ItemIsEditable) # cell = self._list_right.get_cell(1, self._list_right.rows_count - 1) # cell.setTextAlignment(QtCore.Qt.AlignCenter) def onclick_right(row, column): # # print(dir(self._list_right)) if column == 0: index = self._list_right.selected_row_index print(index) self._list_right.__sub__(index) # # r = self._list_right.get_currentrow_value() # self._list_right.__sub__(self._list_right.selected_row_index()) # #cell = self._list_right.get_cell(1, self._list_right.rows_count - 1) # #cell.setTextAlignment(QtCore.Qt.AlignCenter) self._list_left.cell_double_clicked_event = onclick_left self._list_right.cell_double_clicked_event = onclick_right for r in reference_list: self._list_left.__add__([' '.join(r[1:3])]) if Main.hl.harvest_list: for r in Main.hl.harvest_list: self._list_right.__add__([r[0], r[1]])
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 = ControlText('Separator', 'auto') self._startingrow = ControlNumber('Starting row', 0) for index, column in enumerate(columns): setattr(self, '_col_{0}'.format(index), ControlNumber(column, index, -1, 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
def __init__(self): super(Interface, self).__init__('IR project') self._query = ControlText(label='Type your query and press "Enter"; for example:', defaultValue='Albert Einstein') self._query.key_pressed = self.__enter_pressed_event self._pages_result = ControlList('Found web-pages:') self._pages_result.readOnly = True self._pages_result.currentCellChanged = self.__page_selected self._pages_displayed = [] self._papers_result = ControlList('Found papers (by author):') self._papers_result.readOnly = True self._papers_result.currentCellChanged = self.__paper_selected self._papers_displayed = [] self.formset = ['_query', ('_pages_result', '_papers_result')]
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, update_function=None): super().__init__("Saved Points") self._update_function = update_function self._open_file = ControlFile(label="Saved Points File") self._open_file.changed_event = self._on_open_file self._save_file = ControlButton(label="Save") self._save_file.value = self._on_save_file self._saved_points_list = ControlList( label="Saved Points", add_function=self._add_saved_point, remove_function=self._remove_saved_point) self._saved_points_list.data_changed_event = self._change_point self._saved_points_list.horizontal_headers = ["Name", "Value"] self.formset = [('_open_file', '_save_file'), '_saved_points_list']
def __init__(self): super(YourFaceSoundsFamiliar,self).__init__('Your Face Sounds Familiar') #Predict Tab self._imagepath = ControlText('Path') self._browsebuttonpredict = ControlButton('Browse') self._nametopred = ControlText('Name') self._selectfile = ControlFile() self._selectfile.changed = self.__change_path self._predictimage = ControlImage() self._predictbutton = ControlButton('Predict') self._predicteddetails = ControlLabel('Details') self._name = ControlLabel('Recognized Name: ') self._fscore = ControlLabel('FScore: ') self._predictbutton.value = self.__predictbAction #Train Tab self._pername = ControlText('Name') self._selectdir = ControlDir() self._selectdir.changed = self.__change_path_dir self._imagetotrain = ControlImage() # self._imagetotest = ControlImage() self._totrainlist = ControlList("To Train",defaultValue=[]) self.traininglist = self._totrainlist.value self._addtolistbutton = ControlButton('Add') self._addtolistbutton.value = self.__addtolistbAction self._trainbutton = ControlButton('Train') self._trainbutton.value = self.__trainbAction #Formsets self._formset = [{ 'Predict':['_selectfile','=','_nametopred','=','_predictimage', '=','_predictbutton','=', '_predicteddetails','=','_name', '=','_fscore'], 'Train': ['_pername', '=', '_selectdir', '=', '_imagetotrain', '=', '_addtolistbutton','=' , '_totrainlist', '=', '_trainbutton'] }] self.trainingsetall = [] self.nn = self.__init_nn() self.learned = {} self._k = 4 self._trainingPercent = 0.8 self.learned = self.__load_learned() self.cross_validation_set = [np.empty((0,0))]*self._k self.cross_validation_set_y = [np.empty((0,0))]*self._k self.test_set = np.empty((0, 0)) self.testing_y = np.empty((0, 0)) self.training_X = [np.empty((0, 900))] * self._k self.training_y = [np.empty((0, 1))] * self._k self.X = np.empty((0, 0))
def __init__(self, timelineWidget=None, parentWindow=None): super(GraphsProperties, self).__init__('Graphs properties', parentWindow=parentWindow) self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Datasets') self._name = ControlText('Name') self._min_value = ControlNumber('Min', 0, -sys.float_info.max, sys.float_info.max) self._max_value = ControlNumber('Max', 0, -sys.float_info.max, sys.float_info.max) self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Bottom', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._value = ControlLabel() self._formset = [ ( ['_graphs_list','_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top',' '), '_values_zoom', 'info:Choose one dataset and move the mouse over the graph line to visualize the coordenates.', '_value' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False self._remove_graph_btn.value = self.__remove_chart
def __init__(self): super(CsvParserDialog, self).__init__('CSV Choose the columns') self._filename = None # Definition of the forms fields self._filename = ControlFile('CSV File') self._separator = ControlText('Separator', ';') self._frameCol = ControlNumber('Frame column', 0, 0, 100) self._xCol = ControlNumber('X column', 1, 0, 100) self._yCol = ControlNumber('Y column', 2, 0, 100) self._zCol = ControlNumber('Z column', 3, 0, 100) self._filePreview = ControlList('Preview') self._loadButton = ControlButton('Load') self._formset = ['_filename', ('_separator', '_frameCol', '_xCol', '_yCol', '_zCol', '_loadButton'), '_filePreview'] self._separator.changed = self.__refreshPreview self._filename.changed = self.__refreshPreview
class Interface(BaseWidget): def __init__(self): super(Interface, self).__init__('IR project') self._query = ControlText(label='Type your query and press "Enter"; for example:', defaultValue='Albert Einstein') self._query.key_pressed = self.__enter_pressed_event self._pages_result = ControlList('Found web-pages:') self._pages_result.readOnly = True self._pages_result.currentCellChanged = self.__page_selected self._pages_displayed = [] self._papers_result = ControlList('Found papers (by author):') self._papers_result.readOnly = True self._papers_result.currentCellChanged = self.__paper_selected self._papers_displayed = [] self.formset = ['_query', ('_pages_result', '_papers_result')] def __enter_pressed_event(self, e): if e.key() == QtCore.Qt.Key_Return: query = query_words(self._query.value) self._pages_displayed, self._papers_displayed = process_query(query, self._query.value) self._pages_result.clear() self._pages_result.value = [(QtGui.QLabel(format_text(query, document, 'pages')),) for document in self._pages_displayed] self._pages_result.resizeRowsToContents() self._papers_result.clear() self._papers_result.value = [(QtGui.QLabel(format_text(query, document, 'papers')),) for document in self._papers_displayed] self._papers_result.resizeRowsToContents() def __page_selected(self, next_row, unused1, unused2, unused3): open_url(self._pages_displayed[next_row]['url']) def __paper_selected(self, next_row, unused1, unused2, unused3): open_url(self._papers_displayed[next_row]['url'])
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, 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): super(ChooseColumnsWindow, self).__init__('CSV Choose the columns') self._filename = None # Definition of the forms fields self._filename = ControlFile('File') self._separator = ControlText('Separator', ';') self._frameCol = ControlNumber('Frame column', 0, 0, 100) self._xCol = ControlNumber('X column', 1, 0, 100) self._yCol = ControlNumber('Y column', 2, 0, 100) self._showZ = ControlCheckBox('Import Z value') # Not being used yet self._zCol = ControlNumber('Z column', 0, 0, 100) # Not being used yet self._filePreview = ControlList('Preview') self._loadButton = ControlButton('Load') self._formset = ['_filename', ('_separator', '_frameCol', '_xCol', '_yCol', '_loadButton'), '_filePreview'] self._separator.changed = self.__refreshPreview self._filename.changed = self.__refreshPreview self._zCol.hide() self._showZ.changed = self.__showZChanged
def __init__(self): super(MainApp, self).__init__('Simple example 1') self._movieWindow = ControlEmptyWidget() self._clientWindow = ControlEmptyWidget() self._rentalWindow = ControlEmptyWidget() self._rentalWindow.value = RentalListWindow(MainApp.rentalController) self._movieWindow.value = MovieListWindow(MainApp.movieController, MainApp.rentalController) self._clientWindow.value = ClientListWindow(MainApp.clientController, MainApp.rentalController) self._middlename = ControlText("sd") self._lateRentals = ControlEmptyWidget() self._lateRentals.value = StatsList("Late Rentals", MainApp.rentalController.lateRentals()) self._mostRentedMoviesByDays = ControlEmptyWidget() self._mostRentedMoviesByDays.value = StatsList("Most rented movies by number of days", MainApp.rentalController.mostRentedMoviesByDays()) self._mostRentedMoviesByNumber = ControlEmptyWidget() self._mostRentedMoviesByNumber.value = StatsList("Most rented movies by number of times they were rented", MainApp.rentalController.mostRentedMoviesByDays()) self._allRentedMovies = ControlEmptyWidget() self._allRentedMovies.value = ControlList("Currently rented movies") self._allRentedMovies.value.value = [[x.id, x.title, x.description, x.genre] for x in MainApp.rentalController.allRentedMovies()] self._allRentedMovies.value.horizontalHeaders = ['Id', 'Title', 'Description', 'Genre'] self._refresh = ControlButton("Refresh") self._refresh.value = self.refresh self._undo = ControlButton("Undo") self._undo.value = self._undoAction self._redo = ControlButton("Redo") self._redo.value = self._redoAction self._refreshMovies = ControlButton("Refresh") self._refreshMovies.value = self._refreshMoviesAction self.formset = [{ 'Movies': ['_movieWindow'], 'Clients': ['_clientWindow'], 'Rentals': ['_rentalWindow', '=', '_refreshMovies'], 'Statistics': ["_lateRentals", "||", "_mostRentedMoviesByNumber", '||', '_mostRentedMoviesByDays', '||', "_allRentedMovies", '=', '_refresh'] }, '=', ['_undo', '||', '_redo']]
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, 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, timelineWidget=None): super(GraphsProperties, self).__init__('Graphs properties') self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min') self._max_value = ControlNumber('Max') self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Top position', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._formset = [ ( ['_graphs_list','_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top',' '), '_values_zoom', ' ' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes
def __init__(self): super(GroupCheckerGui, self).__init__('Group Checker') self._group_name = ControlText('Group Name', CONFIG['group_name']) self._group_name.enabled = False self._allowed_tags = UnicodeControlList( 'Allowed Tags', plusFunction=self.__add_tag_action, minusFunction=self.__remove_tag_action) self.allowed_tags = GuiList( CONFIG['white_filters']['SubstringFilter']['substrings'], self._allowed_tags) self._allowed_ids = ControlList('Allowed Ids', plusFunction=self.__add_id_action, minusFunction=self.__remove_id_action) self.allowed_ids = GuiList( CONFIG['white_filters']['SignerFilter']['ids'], self._allowed_ids) self._bad_posts = ControlCheckBoxList('Bad posts') self._bad_posts._form.listWidget.itemDoubleClicked.connect( self.__show_link_action) self._remove_button = ControlButton('Remove') self._remove_button.value = self.__remove_action self._show_button = ControlButton('Show bad posts') self._show_button.value = self.__show_bad_post_action self.pool = Pool(processes=1) self.bad_posts = [] self._formset = [('', '_group_name', ''), ('', '_allowed_tags', '_allowed_ids', ''), '', ('', '_bad_posts', ''), ('', '_remove_button', '_show_button', ''), '']
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, update_function=None): super().__init__("Points") self._update_function = update_function self._open_file = ControlFile( label="Points File: " ) self._open_file.changed_event = self._on_open_file self._save_file = ControlButton( label="Save" ) self._save_file.value = self._save_points self._points_list = ControlList( label="Points", add_function=self._add_point, remove_function=self._remove_point, auto_resize=False ) self._points_list.data_changed_event = self._change_point self._points_list.horizontal_headers = [ axis.get_name() for axis in self._axis] self._pre_delay_time = ControlNumber( label="Pre Delay Time (s)", default=1, minimum=0, maximum=float('inf'), decimals=5 ) self._measure_time = ControlNumber( label="Measure Time (s)", default=5, minimum=0, maximum=float('inf'), decimals=5 ) self._post_delay_time = ControlNumber( label="Post Delay Time (s)", default=1, minimum=0, maximum=float('inf'), decimals=5 ) self._scan_frequency = ControlNumber( label="Scan Frequency (Hz)", default=10, minimum=0, maximum=float('inf'), decimals=5 ) self._out_file = ControlDir( label="Output Folder: " ) self._scan_button = ControlButton( label="Scan" ) self._scan_button.value = self._begin_scan self.formset = [ ('_open_file', '_save_file'), '_points_list', ('_pre_delay_time', '_post_delay_time'), ('_measure_time', '_scan_frequency'), '_out_file', '_scan_button', ]
class EditHarvest(BaseWidget): def __init__(self): super().__init__('Oogstlijst Manager') reference_list = Main.hl.reference_data self._list_left = ControlList('Stamlijst') self._list_left.readonly = True self._list_right = ControlList('Oogstlijst') self._list_right.select_entire_row = True self._list_right.horizontal_headers = [ 'Oogst', 'Hoeveelheid (kg)', ] self._save_button = ControlButton('Verder') self._save_button.value = self._continue self.formset = ['_list_left', '_list_right', '_save_button'] def onclick_left(row, column): r = self._list_left.get_currentrow_value() self._list_right.__add__(r + [0]) # cell = self._list_right.get_cell(0, self._list_right.rows_count - 1) # cell.setFlags(QtCore.Qt.ItemIsEditable) # cell = self._list_right.get_cell(1, self._list_right.rows_count - 1) # cell.setTextAlignment(QtCore.Qt.AlignCenter) def onclick_right(row, column): # # print(dir(self._list_right)) if column == 0: index = self._list_right.selected_row_index print(index) self._list_right.__sub__(index) # # r = self._list_right.get_currentrow_value() # self._list_right.__sub__(self._list_right.selected_row_index()) # #cell = self._list_right.get_cell(1, self._list_right.rows_count - 1) # #cell.setTextAlignment(QtCore.Qt.AlignCenter) self._list_left.cell_double_clicked_event = onclick_left self._list_right.cell_double_clicked_event = onclick_right for r in reference_list: self._list_left.__add__([' '.join(r[1:3])]) if Main.hl.harvest_list: for r in Main.hl.harvest_list: self._list_right.__add__([r[0], r[1]]) def _continue(self): user_input = self._list_right.value if not user_input: return harvest_list = [] # Combine user input with reference data for row in user_input: reference = [ ref for ref in Main.hl.reference_data if\ ref[1] and ref[1] in row[0] and ref[2] and ref[2] in row[0] ][0] if not reference: raise Exception('Reference data not found') row += [reference[0]] # add prod nr row += [reference[2]] # add part row += [reference[3]] # add date harvest_list.append(row) Main.hl.harvest_list = Main.hl_pickle.harvest_list = harvest_list window = Rapport() Main.root._panel.value = window
def __init__(self, update_function=None): super().__init__("Axis Tab") self._update_function = update_function self._axis_list = ControlList(label='Axis List', default='', add_function=self._on_add_axis, remove_function=self._on_remove_axis) self._axis_list.item_selection_changed_event = self._on_selection_changed self._axis_list.data_changed_event = self._on_data_changed self._axis_list.select_entire_row = True self._axis_hw_type = ControlLabel() self._min = ControlNumber(label="Minimum", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._min.changed_event = self._on_min_changed self._min.visible = False self._max = ControlNumber(label="Maximum", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._max.changed_event = self._on_max_changed self._max.visible = False self._norm_min = ControlNumber(label=" 0%", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._norm_min.changed_event = self._on_norm_min_changed self._norm_min.visible = False self._norm_max = ControlNumber(label="100%", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._norm_max.changed_event = self._on_norm_max_changed self._norm_max.visible = False self._special_axis = ControlEmptyWidget() self._axis_custom = ControlEmptyWidget() self._load_button = ControlFile(label="Load Axis") self._load_button.changed_event = self._on_load_axis self._save_button = ControlButton(label="Save Axis") self._save_button.value = self._on_save_axis self._save_button.visible = False self.formset = [ '_axis_list', ('_axis_hw_type', '_special_axis'), ('_min', '_max'), ('_norm_min', '_norm_max'), '_axis_custom', ('_load_button', '_save_button') ]
class Programming(BaseWidget): 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 updateGlobals(self): while(True): Globals.globalEventList = self._eventList.value time.sleep(0.75) def addEventAction(self): print("addEvent") global newEvent newEvent = [['New Event', 120, 4, 4, 1, 1, 0]] globalNewEvent = ['New Event', 120, 4, 4, 1, 1, 0] self._eventList.value += newEvent Globals.globalEventList.append(globalNewEvent) def deleteEventAction(self): print("deleteEvent") deleteRow = self._eventList.mouseSelectedRowIndex if deleteRow == 0: print("Attempt to delete initEvent blocked") dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE, "You can not delete the Initial Event.") Gtk.Window.set_keep_above(dialog, True) kill = dialog.run() if kill: dialog.destroy() else: self._eventList.__sub__(deleteRow) del Globals.globalEventList[deleteRow] print(Globals.globalEventList) def saveButtonListener(self): saveButtonValueMemory = self._saveButton.value while(True): if saveButtonValueMemory != self._saveButton.value: file = open(self._saveButton.value, 'w') file.write(str(Globals.globalEventList)) file.close() saveButtonValueMemory = self._saveButton.value def loadButtonListener(self): loadButtonValueMemory = self._loadButton.value while(True): if loadButtonValueMemory != self._loadButton.value: file = open(self._loadButton.value, 'r') listVal = ast.literal_eval(file.read()) Globals.globalEventList = listVal self._eventList.value = listVal file.close() loadButtonValueMemory = self._loadButton.value
class YourFaceSoundsFamiliar(BaseWidget): def __init__(self): super(YourFaceSoundsFamiliar,self).__init__('Your Face Sounds Familiar') #Predict Tab self._imagepath = ControlText('Path') self._browsebuttonpredict = ControlButton('Browse') self._nametopred = ControlText('Name') self._selectfile = ControlFile() self._selectfile.changed = self.__change_path self._predictimage = ControlImage() self._predictbutton = ControlButton('Predict') self._predicteddetails = ControlLabel('Details') self._name = ControlLabel('Recognized Name: ') self._fscore = ControlLabel('FScore: ') self._predictbutton.value = self.__predictbAction #Train Tab self._pername = ControlText('Name') self._selectdir = ControlDir() self._selectdir.changed = self.__change_path_dir self._imagetotrain = ControlImage() # self._imagetotest = ControlImage() self._totrainlist = ControlList("To Train",defaultValue=[]) self.traininglist = self._totrainlist.value self._addtolistbutton = ControlButton('Add') self._addtolistbutton.value = self.__addtolistbAction self._trainbutton = ControlButton('Train') self._trainbutton.value = self.__trainbAction #Formsets self._formset = [{ 'Predict':['_selectfile','=','_nametopred','=','_predictimage', '=','_predictbutton','=', '_predicteddetails','=','_name', '=','_fscore'], 'Train': ['_pername', '=', '_selectdir', '=', '_imagetotrain', '=', '_addtolistbutton','=' , '_totrainlist', '=', '_trainbutton'] }] self.trainingsetall = [] self.nn = self.__init_nn() self.learned = {} self._k = 4 self._trainingPercent = 0.8 self.learned = self.__load_learned() self.cross_validation_set = [np.empty((0,0))]*self._k self.cross_validation_set_y = [np.empty((0,0))]*self._k self.test_set = np.empty((0, 0)) self.testing_y = np.empty((0, 0)) self.training_X = [np.empty((0, 900))] * self._k self.training_y = [np.empty((0, 1))] * self._k self.X = np.empty((0, 0)) def __load_learned(self): try: with open('learned.json') as learned_file: for line in learned_file: learned = json.loads(line) for key in learned.keys(): self._totrainlist.__add__([key]) except IOError: learned = {} config = {'input_size': 30 * 30, 'hidden_size': 30 * 30, 'lambda': 1, 'num_labels': (len(learned))} self.nn = NeuralNetwork(config=config) return learned def __predictbAction(self): predictset_filename = 'predictset.csv' np.savetxt(predictset_filename,self.predictset, delimiter=',') prediction = np.argmax(self.nn.predict(self.predictset)) + 1 for k, v in self.learned.iteritems(): if prediction == v: self._name.value = k def __init_nn(self): nn = NeuralNetwork() return nn def __change_path(self): image = cv2.imread(self._selectfile.value) self._predictimage.value = [] self._predictimage.value = FaceDetection().drawrectangle(image) resizedimage = FaceDetection().resizeimageb(self._predictimage.value) croppedimage = FaceDetection().cropface(resizedimage) resizedcroppedimage = FaceDetection().resizeimagea(croppedimage) self.predictset = np.array(resizedcroppedimage[1]).flatten() def __change_path_dir(self): name = self._selectdir.value name = name.split('/') self._pername.value = name.pop(len(name)-1) self._imagetotrain.value = [] # self._imagetotest.value = [] listofimages = os.listdir(self._selectdir.value) listofimages = sorted(listofimages) listofimages = [cv2.imread(os.path.join(self._selectdir.value, filename)) for filename in listofimages] resizedimages = [FaceDetection().resizeimageb(image) for image in listofimages] croppedimages = [FaceDetection().cropface(image) for image in resizedimages] resized_images = [FaceDetection().resizeimagea(image) for image in croppedimages if image is not None] resizedcroppedimages = [image[0] for image in resized_images] resizedcroppedimagesgray = [image[1] for image in resized_images] trainthisImages = resizedcroppedimagesgray[0:int(len(resizedcroppedimagesgray)*self._trainingPercent)] testthisImages = resizedcroppedimagesgray[int(len(resizedcroppedimagesgray)*self._trainingPercent):] self.trainingsetimage = [np.array(image).flatten() for image in trainthisImages] self.testingsetimage = [np.array(image).flatten() for image in testthisImages] self._imagetotrain.value = trainthisImages self.cross_validation = [np.empty((0,0))]*self._k self.cv_size = [0]*self._k l = 0 for j in self.trainingsetimage: if l == self._k: l = 0 self.cross_validation[l] = np.append(self.cross_validation[l], j) self.cv_size[l] += 1 l += 1 self._imagetotrain.value = resizedcroppedimages def __trainbAction(self): config = {'input_size': 30 * 30, 'hidden_size': 30 * 30, 'lambda': 1, 'num_labels': (len(self.learned))} self.nn = NeuralNetwork(config=config) cost_params_fscore = [] for i in range(self._k): cost_params_fscore.append(self.nn.train(self.training_X[i], self.training_y[i], self.cross_validation_set[i], self.test_set, self.cross_validation_set_y[i], self.testing_y)) best_model = max(cost_params_fscore, key=itemgetter(2)) print best_model[0], best_model[2] def __addtolistbAction(self): ### TEST ### if self._pername.value in self.learned: return X = np.array(self.trainingsetimage) # size: 8 X_set = np.empty((0, 0)) # this will be a k-sized set of X slices slice_size = X.shape[0] / self._k # 2 if self._pername.value not in self.learned: label = len(self.learned) + 1 self.learned[self._pername.value] = label else: return for i in range(self._k): sliced = np.delete(X, slice(i*2, (i*2)+2), axis=0) self.training_X[i] = np.append(self.training_X[i], sliced, axis=0) y = np.empty((sliced.shape[0], 1)) y.fill(label) self.training_y[i] = np.append(self.training_y[i], y, axis=0) print self.training_X[i].shape self._totrainlist.__add__([self._pername.value]) with open('learned.json', 'w') as learned_file: learned_file.write(json.dumps(self.learned)) ############ for i in range(self._k): self.cross_validation_set[i] = np.append(self.cross_validation_set[i], self.cross_validation[i]) self.cross_validation_set_y[i] = np.append(self.cross_validation_set_y[i], [label]*self.cv_size[i]) self.test_set = np.append(self.test_set, self.testingsetimage) self.testing_y = np.append(self.testing_y, [label]*(len(self.testingsetimage)))
class GraphsProperties(BaseWidget): def __init__(self, timelineWidget=None, parent_win=None): super(GraphsProperties, self).__init__('Graphs properties', parent_win=parent_win) self.setContentsMargins(10, 10, 10, 10) self._mainwindow = parent_win self._timeline = timelineWidget #self.setMaximumWidth(300) # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min', default=0, minimum=-sys.float_info.max, maximum=sys.float_info.max) self._max_value = ControlNumber('Max', default=0, minimum=-sys.float_info.max, maximum=sys.float_info.max) self._values_zoom = ControlSlider('Amplitude', default=100, minimum=60, maximum=400) self._values_top = ControlNumber('Bottom', default=0, minimum=-1000, maximum=1000) self._remove_graph_btn = ControlButton('Remove graph') self._value = ControlLabel() self._pickcolor = ControlButton('Pick color', default=self.__pickcolor_evt) self._graphs_list.readonly = True self._formset = [ (['_graphs_list', '_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value', ' '), ('_values_top', '_pickcolor'), '_values_zoom', 'info:Choose one graph and move the mouse over \nthe timeline to visualize the coordenates.', '_value' ]), ] self._graphs_list.select_entire_row = True self._graphs_list.item_selection_changed_event = self.__graphs_list_selection_changed self._loaded = False self._current_selected_graph = None self._name.changed_event = self.__save_graphs_changes self._min_value.changed_event = self.__save_graphs_changes self._max_value.changed_event = self.__save_graphs_changes self._values_zoom.changed_event = self.__save_graphs_changes self._values_top.changed_event = self.__save_graphs_changes self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False self._pickcolor.enabled = False self._remove_graph_btn.value = self.__remove_chart def __add__(self, other): self._graphs_list += [other.name] return self def __sub__(self, other): self._graphs_list -= other return self def rename_graph(self, graph_index, newname): self._graphs_list.set_value(graph_index, 0, newname) @property def selected_graph(self): index = self._graphs_list.selected_row_index return self._timeline._charts[index] if (index is not None) else None @property def coordenate_text(self): return self._value @coordenate_text.setter def coordenate_text(self, value): self._value.value = str(value) if value else '' def show(self): super(GraphsProperties, self).show() self._loaded = False def __pickcolor_evt(self): color = QColorDialog.getColor(self._current_selected_graph._color, self, 'Pick a color for the graph') self._current_selected_graph._color = color self._timeline.repaint() def __remove_chart(self): index = self._graphs_list.selected_row_index if index is not None: self._current_selected_graph = None self._timeline._charts.pop(index) self._loaded = False self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False self._pickcolor.enabled = False self._timeline.repaint() self._mainwindow -= index def __graphs_list_selection_changed(self): graph = self.selected_graph self._updating_properties = True if graph is not None: graphmin = np.asscalar(graph.graph_min) if isinstance( graph.graph_min, np.generic) else graph.graph_min graphmax = np.asscalar(graph.graph_max) if isinstance( graph.graph_max, np.generic) else graph.graph_max exponent_min = abs(decimal.Decimal(graphmin).as_tuple().exponent) exponent_max = abs(decimal.Decimal(graphmax).as_tuple().exponent) exponent_min = 4 if exponent_min > 4 else exponent_min exponent_max = 4 if exponent_min > 4 else exponent_min self._name.value = graph.name self._min_value.decimals = exponent_min self._min_value.value = graph.graph_min self._max_value.decimals = exponent_max self._max_value.value = graph.graph_max self._values_zoom.value = graph._zoom * 100.0 self._values_top.value = graph._top self._loaded = True self._name.enabled = True self._min_value.enabled = True self._max_value.enabled = True self._values_zoom.enabled = True self._values_top.enabled = True self._remove_graph_btn.enabled = True self._pickcolor.enabled = True self._current_selected_graph = graph del self._updating_properties def __save_graphs_changes(self): if hasattr(self, '_updating_properties'): return if self._loaded and self._current_selected_graph is not None: graph = self._current_selected_graph #logger.debug('Before: Min: {0} | Max: {1} Zoom: {2}'.format(graph.graph_min, graph.graph_max,graph.zoom ) ) graph.name = self._name.value graph.graph_min = self._min_value.value graph.graph_max = self._max_value.value graph.zoom = self._values_zoom.value / 100.0 graph.top = self._values_top.value logger.debug('Min: {0} | Max: {1} Zoom: {2}'.format( graph.graph_min, graph.graph_max, graph.zoom)) self._timeline.repaint() @property def graphs(self): return self._timeline.graphs def mouse_moveover_timeline_event(self, event): graph = self.selected_graph if graph is not None: graph.mouse_move_evt(event, 0, self.height())
class SavedPointsTab(BaseWidget): """ The Saved Points tab """ _saved_points = {} _update_function = None def __init__(self, update_function=None): super().__init__("Saved Points") self._update_function = update_function self._open_file = ControlFile(label="Saved Points File") self._open_file.changed_event = self._on_open_file self._save_file = ControlButton(label="Save") self._save_file.value = self._on_save_file self._saved_points_list = ControlList( label="Saved Points", add_function=self._add_saved_point, remove_function=self._remove_saved_point) self._saved_points_list.data_changed_event = self._change_point self._saved_points_list.horizontal_headers = ["Name", "Value"] self.formset = [('_open_file', '_save_file'), '_saved_points_list'] def update_events(self, events): pass def _send_events(self): if self._update_function is not None: self._update_function({'saved_points': self._saved_points}) def _update_saved_points(self): self._saved_points_list.clear() for name, value in self._saved_points.items(): self._saved_points_list += [name, value] def add_saved_point(self, name): if not name in self._saved_points: self._saved_points[name] = "0.0" self._update_saved_points() self._send_events() return True else: return False def _add_saved_point(self): window = NewPointWindow(self.add_saved_point) window.show() def _remove_saved_point(self): index = self._saved_points_list.selected_row_index if index is not None: name = self._saved_points_list.get_value(0, index) self._saved_points.pop(name) self._update_saved_points() self._send_events() def _change_point(self, row, col, item): name = self._saved_points_list.get_value(0, row) if col == 1: # The data was edited self._saved_points[name] = item self._send_events() else: # Something else (name) was edited and needs to be changed back if not name in self._saved_points: self._update_saved_points() def _on_open_file(self): if self._open_file.value is not None and self._open_file.value != '': with open(self._open_file.value, newline='') as csvfile: try: csvreader = csv.reader(csvfile) self._saved_points = {} for point in csvreader: self._saved_points[point[0]] = point[1] except: print("Failed to read file") self._update_saved_points() def _on_save_file(self): points_file = QFileDialog.getSaveFileName(caption="Save Points", filter='CSV Files (*.csv)') if points_file[0] is not None and points_file[0] != '': out_points = [] for name, value in self._saved_points.items(): out_points.append([name, value]) with open(points_file[0], 'w', newline='') as csvfile: csvwriter = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL) csvwriter.writerows(out_points)
class GraphsEventsGenerator(BaseWidget): def __init__(self, timeline=None): super(GraphsEventsGenerator, self).__init__('Apply a function to the graph values', 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._graphname = ControlText('Graph name') self._genevts_btn = ControlButton('Generate graph') self._formset = [ (['_graphs_list'], '||', [ '_graphname', '_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 __add__(self, other): self._graphs_list += [other.name] return self def __sub__(self, other): self._graphs_list -= other return self def rename_graph(self, graph_index, newname): self._graphs_list.set_value(graph_index, 0, newname) @property def graphs(self): return self._timeline._charts def show(self): super(GraphsEventsGenerator, self).show() if len(self._graphname.value.strip()) == 0: self._graphname.value = "generated-graph-{0}".format( len(self._timeline.graphs)) def __cell_double_clicked_evt(self, row, column): if len(self._equation.value.strip()) == 0: self._equation.value += '[{0}]'.format( self._graphs_list.value[row][column]) else: self._equation.value += ' and [{0}]'.format( self._graphs_list.value[row][column]) def __generage_events_evt(self): if len(self._graphname.value.strip()) == 0: QMessageBox.warning(self, "Attention!", 'The graph name cannot be empty') return if len(self._equation.value.strip()) == 0: QMessageBox.warning(self, "Attention!", 'The equation cannot be empty') return max_frame = 0 equation = self._equation.value for i, values in enumerate(self._graphs_list.value): graphname = '[{0}]'.format(values[0]) if graphname in equation: max_frame = max(max_frame, len(self.graphs[i])) equation = equation.replace(graphname, 'graphs[{0}][i]'.format(i)) graphs = self.graphs data = [] try: for i in range(max_frame): data.append((i, eval(equation))) self._timeline.add_chart(self._graphname.value, data) self._graphname.value = "generated-graph-{0}".format( len(self._timeline.graphs)) except Exception as e: QMessageBox.warning(self, "Error!", str(e))
class PointsTab(BaseWidget): """ A Tab for a list of points """ _axis = [] _update_function = None _controller = None _sensor = None _lightsource = None _saved_points = None def __init__(self, update_function=None): super().__init__("Points") self._update_function = update_function self._open_file = ControlFile( label="Points File: " ) self._open_file.changed_event = self._on_open_file self._save_file = ControlButton( label="Save" ) self._save_file.value = self._save_points self._points_list = ControlList( label="Points", add_function=self._add_point, remove_function=self._remove_point, auto_resize=False ) self._points_list.data_changed_event = self._change_point self._points_list.horizontal_headers = [ axis.get_name() for axis in self._axis] self._pre_delay_time = ControlNumber( label="Pre Delay Time (s)", default=1, minimum=0, maximum=float('inf'), decimals=5 ) self._measure_time = ControlNumber( label="Measure Time (s)", default=5, minimum=0, maximum=float('inf'), decimals=5 ) self._post_delay_time = ControlNumber( label="Post Delay Time (s)", default=1, minimum=0, maximum=float('inf'), decimals=5 ) self._scan_frequency = ControlNumber( label="Scan Frequency (Hz)", default=10, minimum=0, maximum=float('inf'), decimals=5 ) self._out_file = ControlDir( label="Output Folder: " ) self._scan_button = ControlButton( label="Scan" ) self._scan_button.value = self._begin_scan self.formset = [ ('_open_file', '_save_file'), '_points_list', ('_pre_delay_time', '_post_delay_time'), ('_measure_time', '_scan_frequency'), '_out_file', '_scan_button', ] def update_events(self, events): """ Updates all events """ # Update the points with the most recent axis if 'axis' in events: self._axis = events['axis'] self._update_lists() if 'sensor' in events: self._sensor = events['sensor'] if 'lightsource' in events: self._lightsource = events['lightsource'] if 'scan' in events: state = events['scan'][0] if state == AxisControllerState.DONE: self._scan_button.label = "Scan" else: self._scan_button.label = "Stop" if 'saved_points' in events: self._saved_points = events['saved_points'] def _update_lists(self): self._points_list.clear() self._points_list.horizontal_headers = [ axis.get_name() for axis in self._axis] self._points_list.resize_rows_contents() length = self._max_axis_len() for i in range(0, length): point = [] for axis in self._axis: assert isinstance(axis, ControlAxis) # Add enough extra points to the axis so it matches the rest of the axis if it is missing points if len(axis.points) <= i: for j in range(len(axis.points) - 1, i): axis.points.append(str(axis.get_min())) point.append(str(axis.points[i])) self._points_list += point self._points_list.resize_rows_contents() def _max_axis_len(self): """ Get the number of points in the axis that has the most points """ max_len = 0 for axis in self._axis: assert isinstance(axis, ControlAxis) if len(axis.points) > max_len: max_len = len(axis.points) return max_len def _add_point(self): for axis in self._axis: assert isinstance(axis, ControlAxis) axis.points.append("0.0") self._update_lists() def _remove_point(self): index = self._points_list.selected_row_index if index is not None: for axis in self._axis: assert isinstance(axis, ControlAxis) axis.points.pop(index) self._update_lists() def _change_point(self, row, col, item): if len(self._axis) > col and len(self._axis[col].points) > row: try: self._axis[col].points[row] = float(item) except ValueError: self._axis[col].points[row] = item def _begin_scan(self): """ Create an AxisController and begin scanning """ if self._controller is None or self._controller.get_state() == AxisControllerState.DONE: self._controller = AxisController( self._axis, self._sensor, self._lightsource, self._pre_delay_time.value, self._measure_time.value, self._post_delay_time.value, self._scan_frequency.value, self._saved_points, self._out_file.value, self._update_function) self._controller.begin() else: self._controller.stop() def _on_open_file(self): """ Open a csv file and rearange columns accoring to header """ print("Opening File:", self._open_file.value) if self._open_file.value is not None and self._open_file.value != '': with open(self._open_file.value, newline='') as csvfile: try: csvreader = csv.reader(csvfile) self._parse_file(csvreader) except: print("Failed to read file") def _parse_file(self, csvreader): for axis in self._axis: if isinstance(axis, ControlAxis): axis.points.clear() self._points_list.clear() points = [] for row in csvreader: for index, data in enumerate(row): if len(points) <= index: points.append([]) points[index].append(data) #print(points) for points_list in points: print(points_list[0]) if isinstance(points_list[0], str): for axis in self._axis: if points_list[0] == axis.get_name(): axis.points.clear() for point in points_list[1:]: try: axis.points.append(float(point)) except ValueError: axis.points.append(point) #print(axis.get_name(), axis.points) self._update_lists() def _save_points(self): points_file = QFileDialog.getSaveFileName( caption="Save Points", filter='CSV Files (*.csv)') if points_file[0] is not None and points_file[0] != '': out_points = [] headers = [] for axis in self._axis: headers.append(axis.get_name()) out_points.append(headers) length = self._max_axis_len() for i in range(0, length): point = [] for axis in self._axis: assert isinstance(axis, ControlAxis) # Add enough extra points to the axis so it matches the rest of the axis if it is missing points if len(axis.points) <= i: for j in range(len(axis.points) - 1, i): axis.points.append(str(axis.get_min())) point.append(str(axis.points[i])) out_points.append(point) with open(points_file[0], 'w', newline='') as csvfile: csvwriter = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL) csvwriter.writerows(out_points) self._open_file.value = points_file[0]
class GraphsProperties(BaseWidget): def __init__(self, timelineWidget=None): super(GraphsProperties, self).__init__('Graphs properties') self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min') self._max_value = ControlNumber('Max') self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Top position', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._formset = [ ( ['_graphs_list','_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top',' '), '_values_zoom', ' ' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes def show(self): super(GraphsProperties, self).show() self._loaded = False self._graphs_list.clear() for graph in self._timeline._charts: self._graphs_list += [graph.name] def __graphs_list_selection_changed(self): index = self._graphs_list.mouseSelectedRowIndex if index is not None: graph = self._timeline._charts[index] exponent_min = abs(decimal.Decimal(graph._graphMin).as_tuple().exponent) exponent_max = abs(decimal.Decimal(graph._graphMax).as_tuple().exponent) exponent_min = 4 if exponent_min>4 else exponent_min exponent_max = 4 if exponent_min>4 else exponent_min self._name.value = graph.name self._min_value.decimals = exponent_min self._min_value.value = graph._graphMin self._max_value.decimals = exponent_max self._max_value.value = graph._graphMax self._values_zoom.value = graph._zoom * 100.0 self._values_top.value = graph._top self._loaded = True def __save_graphs_changes(self): index = self._graphs_list.mouseSelectedRowIndex if self._loaded and index is not None: graph = self._timeline._charts[index] graph.name = self._name.value; self._graphs_list.setValue(0, index, self._name.value) graph._graphMin = self._min_value.value graph._graphMax = self._max_value.value graph._zoom = self._values_zoom.value / 100.0 graph._top = self._values_top.value self._timeline.repaint()
class GraphsProperties(BaseWidget): def __init__(self, timelineWidget=None, parentWindow=None): super(GraphsProperties, self).__init__('Graphs properties', parentWindow=parentWindow) self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Datasets') self._name = ControlText('Name') self._min_value = ControlNumber('Min', 0, -sys.float_info.max, sys.float_info.max) self._max_value = ControlNumber('Max', 0, -sys.float_info.max, sys.float_info.max) self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Bottom', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._value = ControlLabel() self._formset = [ ( ['_graphs_list','_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top',' '), '_values_zoom', 'info:Choose one dataset and move the mouse over the graph line to visualize the coordenates.', '_value' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False self._remove_graph_btn.value = self.__remove_chart @property def selected_chart(self): index = self._graphs_list.mouseSelectedRowIndex return self._timeline._charts[0] if (index is not None) else None @property def coordenate_text(self): return self._value @coordenate_text.setter def coordenate_text(self, value): self._value.value = str(value) if value else '' def show(self): super(GraphsProperties, self).show() self._loaded = False self._graphs_list.clear() for graph in self._timeline._charts: self._graphs_list += [graph.name] def __remove_chart(self): index = self._graphs_list.mouseSelectedRowIndex if index is not None: self._graphs_list -= -1 self._timeline._charts.pop(index) self._timeline.repaint() def __graphs_list_selection_changed(self): index = self._graphs_list.mouseSelectedRowIndex if index is not None: graph = self._timeline._charts[index] exponent_min = abs(decimal.Decimal(graph._graphMin).as_tuple().exponent) exponent_max = abs(decimal.Decimal(graph._graphMax).as_tuple().exponent) exponent_min = 4 if exponent_min>4 else exponent_min exponent_max = 4 if exponent_min>4 else exponent_min self._name.value = graph.name self._min_value.decimals = exponent_min self._min_value.value = graph._graphMin self._max_value.decimals = exponent_max self._max_value.value = graph._graphMax self._values_zoom.value = graph._zoom * 100.0 self._values_top.value = graph._top self._loaded = True self._name.enabled = True self._min_value.enabled = True self._max_value.enabled = True self._values_zoom.enabled = True self._values_top.enabled = True self._remove_graph_btn.enabled = True else: self._name.enabled = False self._min_value.enabled = False self._max_value.enabled = False self._values_zoom.enabled = False self._values_top.enabled = False self._remove_graph_btn.enabled = False def __save_graphs_changes(self): index = self._graphs_list.mouseSelectedRowIndex if self._loaded and index is not None: graph = self._timeline._charts[index] logger.debug('Before: Min: {0} | Max: {1} Zoom: {2}'.format(graph.graph_min, graph.graph_max,graph.zoom ) ) graph.name = self._name.value; self._graphs_list.setValue(0, index, self._name.value) graph.graph_min = self._min_value.value graph.graph_max = self._max_value.value graph.zoom = self._values_zoom.value / 100.0 graph.top = self._values_top.value logger.debug('Min: {0} | Max: {1} Zoom: {2}'.format(graph.graph_min, graph.graph_max,graph.zoom ) ) self._timeline.repaint() @property def charts(self): return self._timeline._charts
class AxisTab(BaseWidget): """ The Axis Tab in the main GUI """ _axis = [] _xaxis = None _yaxis = None _events = True _update_function = None def __init__(self, update_function=None): super().__init__("Axis Tab") self._update_function = update_function self._axis_list = ControlList(label='Axis List', default='', add_function=self._on_add_axis, remove_function=self._on_remove_axis) self._axis_list.item_selection_changed_event = self._on_selection_changed self._axis_list.data_changed_event = self._on_data_changed self._axis_list.select_entire_row = True self._axis_hw_type = ControlLabel() self._min = ControlNumber(label="Minimum", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._min.changed_event = self._on_min_changed self._min.visible = False self._max = ControlNumber(label="Maximum", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._max.changed_event = self._on_max_changed self._max.visible = False self._norm_min = ControlNumber(label=" 0%", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._norm_min.changed_event = self._on_norm_min_changed self._norm_min.visible = False self._norm_max = ControlNumber(label="100%", minimum=-float('inf'), maximum=float('inf'), decimals=5) self._norm_max.changed_event = self._on_norm_max_changed self._norm_max.visible = False self._special_axis = ControlEmptyWidget() self._axis_custom = ControlEmptyWidget() self._load_button = ControlFile(label="Load Axis") self._load_button.changed_event = self._on_load_axis self._save_button = ControlButton(label="Save Axis") self._save_button.value = self._on_save_axis self._save_button.visible = False self.formset = [ '_axis_list', ('_axis_hw_type', '_special_axis'), ('_min', '_max'), ('_norm_min', '_norm_max'), '_axis_custom', ('_load_button', '_save_button') ] 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 def _send_events(self): if self._events and self._update_function is not None: self._update_function({ 'axis': self._axis, 'xaxis': self._xaxis, 'yaxis': self._yaxis }) def update_events(self, events): #print("Axis Tab", events) for axis in self._axis: if isinstance(axis, ControlAxis): axis.update_events(events) def _on_add_axis(self): win = NewAxisWindow(self.add_axis) win.show() def _on_remove_axis(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] assert isinstance(axis, ControlAxis) self._axis_list -= index self._axis.pop(index) if not axis is None: if axis == self._xaxis: self._xaxis = None if axis == self._yaxis: self._yaxis = None self._send_events() def add_axis(self, axis): """ Add an axis to the list """ if not axis is None: self._axis_list += [axis.get_name()] self._axis += [axis] self._axis_list.tableWidget.selectRow(self._axis_list.rows_count - 1) # self._update_shown_axis() self._send_events() def _on_selection_changed(self): self._update_shown_axis() def _on_data_changed(self, row, _, item): if row < len(self._axis): axis = self._axis[row] if not axis is None: axis.set_name(item) #self._update_shown_axis() self._send_events() def _on_min_changed(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] assert isinstance(axis, ControlAxis) if axis is not None: if axis.get_min() != self._min.value: axis.set_min(self._min.value) self._send_events() def _on_max_changed(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] assert isinstance(axis, ControlAxis) if axis is not None: if axis.get_max() != self._max.value: axis.set_max(self._max.value) self._send_events() def _on_norm_min_changed(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] assert isinstance(axis, ControlAxis) if axis is not None: if axis.get_norm_min() != self._norm_min.value: axis.set_norm_min(self._norm_min.value) self._send_events() def _on_norm_max_changed(self): index = self._axis_list.selected_row_index if not index is None: axis = self._axis[index] assert isinstance(axis, ControlAxis) if axis is not None: if axis.get_norm_max() != self._norm_max.value: axis.set_norm_max(self._norm_max.value) self._send_events() def _on_load_axis(self): """ Load an axis from a saved axis file """ if self._load_button.value is not None and self._load_button.value != '': data = {} with open(self._load_button.value) as output_file: try: data = dict(json.load(output_file)) except: print("Could not read file") return print(data) if 'hw_type' in data: name = "" if 'name' in data: name = data['name'] axis = None for axis_type in ControlAxis.__subclasses__(): if axis_type.__name__ == data['hw_type']: axis = axis_type(name) if axis is None: print("No hardware type found!") return assert isinstance(axis, ControlAxis) self.add_axis(axis) #self._update_shown_axis() if 'min' in data: self._min.load_form(data['min']) if 'max' in data: self._max.load_form(data['max']) if 'norm_min' in data: self._norm_min.load_form(data['norm_min']) if 'norm_max' in data: self._norm_max.load_form(data['norm_max']) if 'special_axis' in data: self._special_axis.value.load_form(data['special_axis']) self._axis_custom.value = axis.get_custom_config() if 'axis-specific' in data and self._axis_custom.value is not None: self._axis_custom.value.load_form(data['axis-specific']) def _on_save_axis(self): """ Save an axis to a file """ data = {} data['name'] = self._axis_list.get_currentrow_value()[0] data['hw_type'] = self._axis_hw_type.value data['min'] = {} self._min.save_form(data['min']) data['max'] = {} self._max.save_form(data['max']) data['norm_min'] = {} self._norm_min.save_form(data['norm_min']) data['norm_max'] = {} self._norm_max.save_form(data['norm_max']) data['special_axis'] = {} self._special_axis.value.save_form(data['special_axis']) if self._axis_custom.value is not None: data['axis-specific'] = {} self._axis_custom.value.save_form(data['axis-specific']) print(data) filename = QFileDialog.getSaveFileName(self, 'Save Axis', filter='JSON Files (*.json)') if filename[0] is not None and filename[0] != '': with open(filename[0], 'w') as output_file: json.dump(data, output_file, indent=2)
class Graph2Event(BaseWidget): 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 __add__(self, other): self._graphs_list += [other.name] return self def __sub__(self, other): self._graphs_list -= other return self def rename_graph(self, graph_index, newname): self._graphs_list.set_value(graph_index, 0, newname) @property def graphs(self): return self._timeline._charts def __cell_double_clicked_evt(self, row, column): if len(self._equation.value.strip()) == 0: self._equation.value += '[{0}]'.format( self._graphs_list.value[row][column]) else: self._equation.value += ' and [{0}]'.format( self._graphs_list.value[row][column]) def __generage_events_evt(self): if len(self._eventname.value.strip()) == 0: QMessageBox.warning(self, "Attention!", 'The event name cannot be empty') return if len(self._equation.value.strip()) == 0: QMessageBox.warning(self, "Attention!", 'The equation cannot be empty') return max_frame = 0 equation = self._equation.value for i, values in enumerate(self._graphs_list.value): graphname = '[{0}]'.format(values[0]) if graphname in equation: max_frame = max(max_frame, len(self.graphs[i])) equation = equation.replace(graphname, 'graphs[{0}][i]'.format(i)) graphs = self.graphs last_index = None last_value = False try: for i in range(max_frame): try: value = eval(equation) except: value = False if not last_value and bool(value): last_index = i last_value = True if last_value and not bool(value): if (i - 1 - last_index) >= self._mindiff.value: self._timeline.add_period( [last_index, i - 1, self._eventname.value], int(self._rownumber.value)) last_value = False last_index = None if last_value and (max_frame - last_index) >= self._mindiff.value: self._timeline.add_period( [last_index, max_frame, self._eventname.value], int(self._rownumber.value)) except Exception as e: traceback.print_exc() QMessageBox.warning(self, "Error!", str(e)) self._timeline.repaint()
class GraphsProperties(BaseWidget): def __init__(self, timelineWidget=None): super(GraphsProperties, self).__init__('Graphs properties') self.setContentsMargins(10, 10, 10, 10) self._timeline = timelineWidget # Definition of the forms fields self._graphs_list = ControlList('Graphs list') self._name = ControlText('Name') self._min_value = ControlNumber('Min') self._max_value = ControlNumber('Max') self._values_zoom = ControlSlider('Amplitude', 100, 60, 400) self._values_top = ControlNumber('Top position', 0, -1000, 1000) self._remove_graph_btn = ControlButton('Remove graph') self._formset = [ (['_graphs_list', '_remove_graph_btn'], '||', [ ' ', '_name', ('_min_value', '_max_value'), ('_values_top', ' '), '_values_zoom', ' ' ]), ] self._graphs_list.itemSelectionChanged = self.__graphs_list_selection_changed self._loaded = False self._name.changed = self.__save_graphs_changes self._min_value.changed = self.__save_graphs_changes self._max_value.changed = self.__save_graphs_changes self._values_zoom.changed = self.__save_graphs_changes self._values_top.changed = self.__save_graphs_changes def show(self): super(GraphsProperties, self).show() self._loaded = False self._graphs_list.clear() for graph in self._timeline._charts: self._graphs_list += [graph.name] def __graphs_list_selection_changed(self): index = self._graphs_list.mouseSelectedRowIndex if index is not None: graph = self._timeline._charts[index] exponent_min = abs( decimal.Decimal(graph._graphMin).as_tuple().exponent) exponent_max = abs( decimal.Decimal(graph._graphMax).as_tuple().exponent) exponent_min = 4 if exponent_min > 4 else exponent_min exponent_max = 4 if exponent_min > 4 else exponent_min self._name.value = graph.name self._min_value.decimals = exponent_min self._min_value.value = graph._graphMin self._max_value.decimals = exponent_max self._max_value.value = graph._graphMax self._values_zoom.value = graph._zoom * 100.0 self._values_top.value = graph._top self._loaded = True def __save_graphs_changes(self): index = self._graphs_list.mouseSelectedRowIndex if self._loaded and index is not None: graph = self._timeline._charts[index] graph.name = self._name.value self._graphs_list.setValue(0, index, self._name.value) graph._graphMin = self._min_value.value graph._graphMax = self._max_value.value graph._zoom = self._values_zoom.value / 100.0 graph._top = self._values_top.value self._timeline.repaint()