def updateTable(self): queryset = self.queryset() self.pagination = paginate(queryset, self.page, perPage=12) items = self.pagination.items self.table.setRowCount(len(items)) self.table.setColumnWidth(0, 50) self.table.setColumnWidth(2, 140) self.table.setColumnWidth(3, 50) for row, item in enumerate(items): self.table.setItem(row, 0, QTableWidgetItem(item.tt)) self.table.setItem(row, 1, QTableWidgetItem(item.rptInline)) if item.sent: sent = item.sent.strftime('%Y-%m-%d %H:%M:%S') self.table.setItem(row, 2, QTableWidgetItem(sent)) if item.confirmed: checkedItem = QTableWidgetItem() checkedItem.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) checkedItem.setIcon(QIcon(':/checkmark.png')) self.table.setItem(row, 3, checkedItem) else: checkedItem = QTableWidgetItem() checkedItem.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) checkedItem.setIcon(QIcon(':/cross.png')) self.table.setItem(row, 3, checkedItem) if 'COR' in item.rpt or 'AMD' in item.rpt: self.table.item(row, 0).setForeground(self.color) self.table.item(row, 1).setForeground(self.color) self.table.item(row, 2).setForeground(self.color) self.table.resizeRowsToContents()
def updateTable(self): queryset = self.queryset() self.pagination = paginate(queryset, self.page, perPage=12) items = self.pagination.items self.table.setRowCount(len(items)) self.table.setColumnWidth(0, 50) for row, item in enumerate(items): self.table.setItem(row, 0, QTableWidgetItem(item.tt)) self.table.setItem(row, 1, QTableWidgetItem(item.rpt)) if item.tt == 'SP': self.table.item(row, 0).setForeground(self.color) self.table.item(row, 1).setForeground(self.color) self.table.resizeRowsToContents()
def updateTable(self): queryset = self.queryset() self.pagination = paginate(queryset, self.page, perPage=6) items = self.pagination.items self.table.setRowCount(len(items)) self.table.setColumnWidth(0, 50) self.table.setColumnWidth(2, 140) self.table.setColumnWidth(3, 50) for row, item in enumerate(items): self.table.setItem(row, 0, QTableWidgetItem(item.tt)) self.table.setItem(row, 1, QTableWidgetItem(item.rpt)) if item.sent: sent = item.sent.strftime('%Y-%m-%d %H:%M:%S') self.table.setItem(row, 2, QTableWidgetItem(sent)) self.table.resizeRowsToContents()