def insertOrUpdate(self, l): """ Inserts or updates a whole list of tasklists """ for t in l: debug(0, "Inserting (or updating) tasklist into DB: " + str(t)) TaskList.insertOrUpdate(t) self.beginResetModel() self.readTaskLists() self.endResetModel() self.setViewRow.emit(self.currentRow)
def setData(self, index, value, role): if index.isValid and role == Qt.EditRole: tl = self.taskLists[index.row()] tl.name = str(value.toString()) TaskList.update(tl) self.taskLists[index.row()] = tl self.dataChanged.emit(index, index) return True else: return False
def readTaskLists(self): self.taskLists = TaskList.getAll() #First row is a pseudo "ALL TASKS" row self.taskLists.insert(0, TaskList("", "All Tasks", id=-1))