def init_gui(self): # Set integer validator for the port number int_validator = QIntValidator(1024, 49151) self.txtPort.setValidator(int_validator) # Load profiles self.load_profiles() # Set current profile in the combobox curr_profile = current_profile() if not curr_profile is None: GuiUtils.set_combo_current_index_by_text(self.cbo_profiles, curr_profile.name) # Load current database connection properties self._load_db_conn_properties() # Load existing PostgreSQL connections self._load_qgis_pg_connections() # Load directory paths self._load_directory_paths() self.edtEntityRecords.setMaximum(MAX_LIMIT) self.edtEntityRecords.setValue(get_entity_browser_record_limit()) # Debug logging lvl = debug_logging() if lvl: self.chk_logging.setCheckState(Qt.Checked) else: self.chk_logging.setCheckState(Qt.Unchecked)
def set_current_spatial_field(self, spatial_field): """ Selects the current spatial field column in the combo of available spatial columns. :param spatial_field: Name of the spatial field to select. :type spatial_field: str """ GuiUtils.set_combo_current_index_by_text(self.cboSpatialFields, spatial_field)
def set_from_item(self): # Load referenced table editor with item configuration settings. photo_props = LinkedTableProps(linked_table=self._item.linked_table(), source_field=self._item.source_field(), linked_field=self._item.linked_field()) self.ref_table.set_properties(photo_props) GuiUtils.set_combo_current_index_by_text(self.cbo_document_type, self._item.document_type())
def set_configuration(self, configuration): self._changed_blocked = True GuiUtils.set_combo_current_index_by_text(self.cbo_x_field, configuration.x_field()) self.txt_x_label.setText(configuration.x_label()) self.txt_y_label.setText(configuration.y_label()) # Set barvalue configurations for bar_cfg in configuration.value_configurations(): self.add_value_configuration(bar_cfg) self._changed_blocked = False
def _load_legend_positions(self): from stdm.composer.chart_configuration import legend_positions self.cbo_legend_pos.clear() for k, v in legend_positions.items(): self.cbo_legend_pos.addItem(k, v) # Select 'Automatic' option GuiUtils.set_combo_current_index_by_text( self.cbo_legend_pos, QApplication.translate("ChartConfiguration", "Automatic"))
def onDataSourceSelected(self, dataSource): """ Slot raised upon selecting a data source from the items. """ # Enable/disable referenced table combo only if an item is selected if self.category() == 'View': if not dataSource: self.cboReferencedTable.setEnabled(False) else: self.cboReferencedTable.setEnabled(True) if self._sync_data_source: GuiUtils.set_combo_current_index_by_text(self.cboReferencedTable, dataSource) data_source_name = self.cboDataSource.currentData() # this causes the QgsLayout.variablesChanged signal to be emitted -- listening objects should hook to this LayoutUtils.set_stdm_data_source_for_layout(self._layout, data_source_name)
def set_properties(self, table_props): """ Sets the combo selection based on the text in the linked table object properties. :param table_props: Object containing the linked table information. :type table_props: LinkedTableProps """ self._block_changed = True GuiUtils.set_combo_current_index_by_text(self.cbo_ref_table, table_props.linked_table) GuiUtils.set_combo_current_index_by_text(self.cbo_source_field, table_props.source_field) GuiUtils.set_combo_current_index_by_text(self.cbo_referencing_col, table_props.linked_field) self._block_changed = False