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, 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, 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, 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, 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): 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): 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, 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(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
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, 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, 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): 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, 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 __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') ]