def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.cboDataSource.setInsertPolicy(QComboBox.InsertAlphabetically) self.cboReferencedTable.setInsertPolicy(QComboBox.InsertAlphabetically) self.curr_profile = current_profile() self.rbTables.toggled.connect(self.onShowTables) self.rbViews.toggled.connect(self.onShowViews) # Load reference tables self._ref_tables = profile_entities(self.curr_profile) # Load all tables self._tables = profile_user_tables(self.curr_profile, False) # Populate referenced tables self._populate_referenced_tables() # Flag for synchronizing data source item change to referenced table self._sync_data_source = False # Force views to be loaded self.rbViews.toggle() # Connect signal self.cboDataSource.currentIndexChanged[str].connect( self.onDataSourceSelected) self.cboReferencedTable.setEnabled(False)
def loadSourceTables(self): #Load all STDM tables self.lstSrcTab.clear() # tables = pg_tables() tables = profile_user_tables(self.curr_profile, True, True, sort=True) for t in tables.keys(): tabItem = QListWidgetItem(t, self.lstSrcTab) tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png")) self.lstSrcTab.addItem(tabItem)
def loadSourceTables(self): # Load all STDM tables self.lstSrcTab.clear() # tables = pg_tables() tables = profile_user_tables(self.curr_profile, True, True, sort=True) for t in tables.keys(): tabItem = QListWidgetItem(t, self.lstSrcTab) tabItem.setIcon(GuiUtils.get_icon("table.png")) self.lstSrcTab.addItem(tabItem)
def db_tables(self): """ Returns both textual and spatial table names. """ curr_profile = current_profile() tables = list( profile_user_tables(self._current_profile, False, True).keys()) return tables
def loadSourceTables(self): #Load all STDM tables self.lstSrcTab.clear() # tables = pg_tables() tables = profile_user_tables( self.curr_profile, True, True, sort=True ) for t in tables.keys(): tabItem = QListWidgetItem(t,self.lstSrcTab) tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png")) self.lstSrcTab.addItem(tabItem)
def db_tables(self): """ Returns both textual and spatial table names. """ curr_profile = current_profile() tables = profile_user_tables( self._current_profile, False, True ).keys() return tables
def loadTables(self, type): #Load textual or spatial tables self.lstDestTables.clear() tables = None if type == "textual": tables = profile_user_tables(self.curr_profile, False, True) elif type == "spatial": tables = profile_spatial_tables(self.curr_profile) if tables is not None: for t in tables: tabItem = QListWidgetItem(t,self.lstDestTables) tabItem.setCheckState(Qt.Unchecked) tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png")) self.lstDestTables.addItem(tabItem)
def load_tables_of_type(self, type: str, initial_selection: Optional[str] = None): """ Load textual or spatial tables If initial_selection is specified then that table will be initially checked """ self.lstDestTables.clear() tables = None if type == "textual": tables = profile_user_tables(self.curr_profile, False, True, include_read_only=False) elif type == "spatial": tables = profile_spatial_tables(self.curr_profile, include_read_only=False) if tables is not None: for table_name, table_label in tables.items(): table_item = QListWidgetItem(table_label, self.lstDestTables) table_item.setData(ImportData.ROLE_TABLE_NAME, table_name) if initial_selection: table_item.setCheckState( Qt.Checked if ImportData.names_are_matching(table_name, initial_selection) else Qt.Unchecked) else: table_item.setCheckState(Qt.Unchecked) table_item.setIcon(GuiUtils.get_icon("table.png")) self.lstDestTables.addItem(table_item)