def updateTree(self): year = self.cmbYear.currentText() sMonth = self.cmbMonth.currentText() month = key_from_value(self.months, sMonth) data = LibStats.getTipster(year, month) self.treeMonth.clear() items = [] for i in data: item = QTreeWidgetItem(i) item = paint_row(item, i[5]) items.append(item) self.treeMonth.addTopLevelItems(items)
def initData(self): self.years, self.months = LibStats.getYears() self.cmbYear.addItems(self.years.keys()) firstKey = next(iter(self.years)) self.cmbMonth.addItems(self.getMonths(firstKey)) data = LibStats.getTipster() items = [] for i in data: item = QTreeWidgetItem(i) item = paint_row(item, i[5]) items.append(item) self.treeTotal.addTopLevelItems(items) self.updateMonths()