Ejemplo n.º 1
0
	def fillCells(self):
		self.ui.tableWidget.clearContents()
		fields = appInst.getVisibleHeaders(appInst.getTable(self.tableName))
		values = appInst.selectAllWithForeignValues(self.tableName, self.isReport)
		self.ui.tableWidget.setRowCount(len(values) + (1 if self.isReport else 0))
		row = -1
		for value in values:
			row = row + 1
			column = -1
			for item in value:
				column = column + 1
				it = item
				if isEnum(fields[column]):
					it = globals()[fields[column].name][int(item)]
				newitem = QtGui.QTableWidgetItem(str(it))
				self.ui.tableWidget.setItem(row, column, newitem)
		
		if self.isReport:
			newitem = QtGui.QTableWidgetItem(str(appInst.cntSum()))
			self.ui.tableWidget.setItem(row + 1, column, newitem)
			
		self.primaryKeys = self.findPrimaryKeys()
Ejemplo n.º 2
0
	def fillCells(self):
		self.ui.tableWidget.clearContents()
		filterParams = self.getFilterParams()
		values = appInst.selectAllWithForeignValues(self.tableName, self.isReport, filterParams)
		self.ui.tableWidget.setRowCount(len(values) + (1 if self.isReport else 0))
		row = -1
		column = 0
		for value in values:
			row = row + 1
			column = -1
			for item in value:
				column = column + 1
				it = datetime.timedelta(seconds = item) if column == 3 and self.isReport else item
				newitem = QtGui.QTableWidgetItem(str(it))
				self.ui.tableWidget.setItem(row, column, newitem)
		
		if self.isReport:
			sum = appInst.cntSum(filterParams)
			if sum:
				newitem = QtGui.QTableWidgetItem(str(sum))
				self.ui.tableWidget.setItem(row + 1, column, newitem)

		self.primaryKeys = self.findPrimaryKeys()