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))
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))
def getHistoryModel(self, historyTableName): if not self.historyModel.has_key(historyTableName): self.historyModel[historyTableName] = QtGui.QStringListModel(nafdb.getHistoryTableRows(historyTableName)) return self.historyModel[historyTableName]