def onShowViews(self,state):
     """
     Slot raised to show STDM database views.
     """
     if state:
         self.cboDataSource.clear()
         self.cboDataSource.addItem("")
         self.cboDataSource.addItems(pg_views())
Exemple #2
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
Exemple #3
0
 def initRptDialog(self):
     #Initialize the dialog with table names
     self.tabNames = self.config
     #tabList=self.config.items("ReportFields")
     #tabList=self.config.items()
     user_views = pg_views()
     if user_views:
         for view_name in user_views:
             self.config[view_name.title()] = view_name
     self.tabNames['Social Tenure Relationship'] = 'social_tenure_relations'
     try:
         for name, value in self.config.iteritems():
             self.comboBox.addItem(name, value)
         index = self.comboBox.findText('Social_Tenure_Relations', Qt.MatchExactly)
         if index:
             self.comboBox.removeItem(int(index))
     except Exception as ex:
         self.ErrorInfoMessage(str(ex.message))
     self.initStackWidgets()
     
     #Sorting
     self.tbSortFields.verticalHeader().setVisible(False) 
     self.tbSortFields.setAlternatingRowColors(True)
     self.tbSortFields.setEditTriggers(QAbstractItemView.NoEditTriggers)
     
     #Fields
     self.listWidget.setSelectionMode(QAbstractItemView.MultiSelection)
     self.listWidget_2.setSelectionMode(QAbstractItemView.MultiSelection)
     
     #General
     self.btnGenRpt.setEnabled(False)
     self.btnSave.setEnabled(False)
     
     #Display
     self.trRptSettings.expandAll()
     
     #Filter
     self.txtSqlParser.setWordWrapMode(QTextOption.WordWrap)
     sqlHL = SqlHighlighter(self.txtSqlParser)
     
     #Grouping
     #Hide inapplicable columns
     self.tbGroupFields.verticalHeader().setVisible(False) 
     self.tbGroupFields.setAlternatingRowColors(True)
     self.tbGroupFields.setEditTriggers(QAbstractItemView.NoEditTriggers)
     
     self.initVars()
    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)