Esempio n. 1
0
 def resetData(self):
     self.rowCount = 0
     self.columnCount = 0
     self.columns = nafdb.getColumnNames(self.tableName)
     self.columnCount = len(self.columns)
     if nafdb.connection is not None:
         self.cur = nafdb.connection.cursor()
         # here rowCount actually means the largest requirement id, not the number of requirements
         self.cur.execute("select max(id) from %s;" % self.tableName)
         n = self.cur.fetchone()[0]
         if n is not None:
             self.rowCount = int(n) + 1
         else:
             self.rowCount = 0
         for lutTableName, lookupModel in self.lookupModel.iteritems():
             lutTableRows = [self._translate(item) for item in nafdb.getLookupTableRows(lutTableName)]
             lookupModel.setStringList(lutTableRows)
         for historyTableName, historyModel in self.historyModel.iteritems():
             historyModel.setStringList(nafdb.getHistoryTableRows(historyTableName))
Esempio n. 2
0
 def resetData(self):
     self.rowCount = 0
     self.columnCount = 0
     self.columns = nafdb.getColumnNames(self.tableName)
     self.columnCount = len(self.columns)
     if nafdb.connection is not None:
         self.cur = nafdb.connection.cursor()
         # here rowCount actually means the largest requirement id, not the number of requirements
         self.cur.execute('select max(id) from %s;' % self.tableName)
         n = self.cur.fetchone()[0]
         if n is not None:
             self.rowCount =  int(n)+1
         else:
             self.rowCount = 0
         for lutTableName, lookupModel in self.lookupModel.iteritems():
             lutTableRows = [self._translate(item) for item in nafdb.getLookupTableRows(lutTableName)]
             lookupModel.setStringList(lutTableRows)
         for historyTableName, historyModel in self.historyModel.iteritems():
             historyModel.setStringList(nafdb.getHistoryTableRows(historyTableName))
Esempio n. 3
0
 def getLookupTableRows(self, index):
     return nafdb.getLookupTableRows(self.columns[index.row()].lookupTable, translatorFunc=self._translate)
Esempio n. 4
0
 def getLookupModel(self, lutTableName):
     if not self.lookupModel.has_key(lutTableName):
         lutTableRows = nafdb.getLookupTableRows(lutTableName)
         lutTableRows = [self._translate(item) for item in nafdb.getLookupTableRows(lutTableName)]
         self.lookupModel[lutTableName] = QtGui.QStringListModel(lutTableRows)
     return self.lookupModel[lutTableName]
Esempio n. 5
0
 def getLookupTableRows(self, index):
     return nafdb.getLookupTableRows(self.columns[index.row()].lookupTable,
                                     translatorFunc=self._translate)
Esempio n. 6
0
 def getLookupModel(self, lutTableName):
     if not self.lookupModel.has_key(lutTableName):
         lutTableRows = nafdb.getLookupTableRows(lutTableName)
         lutTableRows = [self._translate(item) for item in nafdb.getLookupTableRows(lutTableName)]
         self.lookupModel[lutTableName] = QtGui.QStringListModel(lutTableRows)
     return self.lookupModel[lutTableName]