Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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_()
Example #4
0
 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_()
Example #5
0
    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)
Example #6
0
 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)