Esempio n. 1
0
 def onShowTables(self,state):
     """
     Slot raised to show STDM database tables.
     """
     if state:
         self.cboDataSource.clear()
         self.cboDataSource.addItem("")
         self.cboDataSource.addItems(pg_tables())
Esempio n. 2
0
    def db_tables(self):
        """
        Returns both textual and spatial table names.
        """
        tables = pg_tables(exclude_lookups=False)
        tables.extend(spatial_tables(exclude_views=True))

        return tables
Esempio n. 3
0
 def loadSourceTables(self):
     #Load all STDM tables
     self.lstSrcTab.clear()
     tables = pg_tables()   
          
     for t in tables:            
         tabItem = QListWidgetItem(t,self.lstSrcTab)
         tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png"))
         self.lstSrcTab.addItem(tabItem)         
Esempio n. 4
0
 def _tableExists(self,tableName):
     """
     Assert whether the a table or view with the given name exists in the 'public' schema.
     """
     tables = pg_tables()
     views = pg_views()
     tables.extend(views)
     
     tableIndex = getIndex(tables, tableName)
     
     return False if tableIndex == -1 else True
Esempio n. 5
0
 def loadTables(self,type):
     #Load textual or spatial tables
     self.lstDestTables.clear()
     
     if type=="textual":
         tables = pg_tables(excludeLookups=False)
         
     elif type=="spatial":
         tables = spatial_tables(excludeViews=True)
                             
     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_link_tables(self, reg_exp=None, source=TABLES|VIEWS):
        self.cbo_ref_table.clear()
        self.cbo_ref_table.addItem("")

        ref_tables = []
        #Table source
        if (TABLES & source) == TABLES:
            ref_tables.extend(pg_tables())

        #View source
        if (VIEWS & source) == VIEWS:
            ref_tables.extend(pg_views())

        source_tables = []
        for t in ref_tables:
            if not reg_exp is None:
                if reg_exp.exactMatch(t):
                    source_tables.append(t)

            else:
                source_tables.append(t)

        self.cbo_ref_table.addItems(source_tables)