def addTask(self): selectedCategory = self.ui.treeWidget.currentItem() if (selectedCategory != None): #for now, we don't allow tasks to have subtasks if (isinstance(selectedCategory, TITaskWidget)): return taskDialog = TITaskDialog(self) selectedCategoryText = selectedCategory.categoryText() selectedCategoryId = selectedCategory.categoryId() taskDialog.setCategoryText(selectedCategoryText) taskDialog.exec_() if (taskDialog.result() == TITaskDialog.Accepted): taskText = str(taskDialog.taskText()) dbHandler = self.dbHandler taskId = dbHandler.addTask(taskText, selectedCategoryId) taskWidget = TITaskWidget(taskText, taskId) selectedCategory.addChild(taskWidget) self.ui.treeWidget.expandItem(selectedCategory) self.tasklistModification(True) self.ui.treeWidget.setCurrentItem(taskWidget)
def addTask(self): selectedCategory = self.ui.treeWidget.currentItem() if(selectedCategory != None): #for now, we don't allow tasks to have subtasks if(isinstance(selectedCategory, TITaskWidget)): return taskDialog = TITaskDialog(self) selectedCategoryText = selectedCategory.categoryText() selectedCategoryId = selectedCategory.categoryId() taskDialog.setCategoryText(selectedCategoryText) taskDialog.exec_() if(taskDialog.result() == TITaskDialog.Accepted): taskText = str(taskDialog.taskText()) dbHandler = self.dbHandler taskId = dbHandler.addTask(taskText, selectedCategoryId) taskWidget = TITaskWidget(taskText, taskId) selectedCategory.addChild(taskWidget) self.ui.treeWidget.expandItem(selectedCategory) self.tasklistModification(True) self.ui.treeWidget.setCurrentItem(taskWidget)
def __displayTask(self, item, column): if (item != None): if (not isinstance(item, TITaskWidget)): return selectedTaskCategoryWidget = item.parent() taskDialog = TITaskDialog(self) selectedTaskText = item.text(textColumnIndex) selectedCategoryText = selectedTaskCategoryWidget.text( textColumnIndex) taskDialog.setCategoryText(selectedCategoryText) taskDialog.setTaskText(selectedTaskText) taskDialog.setReadOnlyMode() taskDialog.exec_()
def __displayTask(self, item, column): if(item != None): if(not isinstance(item, TITaskWidget)): return selectedTaskCategoryWidget = item.parent() taskDialog = TITaskDialog(self) selectedTaskText = item.text(textColumnIndex) selectedCategoryText = selectedTaskCategoryWidget.text(textColumnIndex) taskDialog.setCategoryText(selectedCategoryText) taskDialog.setTaskText(selectedTaskText) taskDialog.setReadOnlyMode() taskDialog.exec_()
def editTask(self): selectedTask = self.ui.treeWidget.currentItem() if (selectedTask != None): if (not isinstance(selectedTask, TITaskWidget)): return selectedTaskText = selectedTask.taskText() taskInput = TITaskDialog(self) taskInput.setCategoryText(selectedTask.taskCategoryText()) taskInput.setTaskText(selectedTaskText) taskInput.exec_() if (taskInput.result() == TITaskDialog.Accepted): selectedTaskId = selectedTask.taskId() updatedTaskText = str(taskInput.taskText()) dbHandler = self.dbHandler dbHandler.editTask(selectedTaskId, updatedTaskText) selectedTask.setTaskText(updatedTaskText) self.tasklistModification(True)
def editTask(self): selectedTask = self.ui.treeWidget.currentItem() if(selectedTask != None): if(not isinstance(selectedTask, TITaskWidget)): return selectedTaskText = selectedTask.taskText() taskInput = TITaskDialog(self) taskInput.setCategoryText(selectedTask.taskCategoryText()) taskInput.setTaskText(selectedTaskText) taskInput.exec_() if(taskInput.result() == TITaskDialog.Accepted): selectedTaskId = selectedTask.taskId() updatedTaskText = str(taskInput.taskText()) dbHandler = self.dbHandler dbHandler.editTask(selectedTaskId, updatedTaskText) selectedTask.setTaskText(updatedTaskText) self.tasklistModification(True)