Пример #1
0
 def newTask(self):
     dialog = NewTaskDialog(self)
     dialog.priority.addItems(self.priority.listNames())
     if dialog.exec_():
         args = {}
         args["name"] = dialog.name.text()
         args["priority"] = self.priority.getCode(
             dialog.priority.currentText())
         args["deadline"] = dialog.deadline.date().toPyDate()
         args = self.task.save("", **args)
         self.refreshTable()
Пример #2
0
 def _updateTask(self, row):
     # id of currently selected row
     _id = int(self.tableWidget.item(row, 0).text())
     row = self.task.read(_id)
     # open dialog for editing record
     dialog = NewTaskDialog(self)
     dialog.name.setText(row["name"])
     dialog.priority.addItems(self.priority.listNames())
     dialog.priority.setCurrentIndex(row['priority'] - 1)
     dialog.deadline.setDate(row['deadline'])
     if dialog.exec_():
         row["name"] = dialog.name.text()
         row["priority"] = self.priority.getCode(
             dialog.priority.currentText())
         row["deadline"] = dialog.deadline.date().toPyDate()
         args = self.task.save(_id, **row)
         self.refreshTable()