diff -r 7015247cbb05 -r 17d03699f151 eric6/Tasks/TaskViewer.py --- a/eric6/Tasks/TaskViewer.py Sun May 02 10:59:00 2021 +0200 +++ b/eric6/Tasks/TaskViewer.py Sun May 02 15:09:14 2021 +0200 @@ -25,7 +25,7 @@ from E5Gui import E5MessageBox from E5Gui.E5ProgressDialog import E5ProgressDialog -from .Task import Task, TaskType +from .Task import Task, TaskType, TaskPriority import UI.PixmapCache @@ -318,8 +318,8 @@ """ self.projectOpen = o - def addTask(self, summary, priority=1, filename="", lineno=0, - completed=False, _time=0, isProjectTask=False, + def addTask(self, summary, priority=TaskPriority.NORMAL, filename="", + lineno=0, completed=False, _time=0, isProjectTask=False, taskType=TaskType.TODO, description="", uid="", parentTask=None): """ @@ -327,8 +327,8 @@ @param summary summary text of the task @type str - @param priority priority of the task (0=high, 1=normal, 2=low) - @type int + @param priority priority of the task + @type TaskPriority @param filename filename containing the task @type str @param lineno line number containing the task @@ -493,16 +493,17 @@ """ from .TaskPropertiesDialog import TaskPropertiesDialog task = self.currentItem() - dlg = TaskPropertiesDialog(task, self, self.projectOpen) - ro = task.getFilename() != "" - if ro: - dlg.setReadOnly() - if dlg.exec() == QDialog.DialogCode.Accepted and not ro: - summary, priority, completed, isProjectTask, description = ( - dlg.getData() - ) + dlg = TaskPropertiesDialog(task, parent=self, + projectOpen=self.projectOpen) + if ( + dlg.exec() == QDialog.DialogCode.Accepted and + dlg.isManualTaskMode() + ): + (summary, priority, taskType, completed, isProjectTask, + description) = dlg.getData() task.setSummary(summary) task.setPriority(priority) + task.setTaskType(taskType) task.setCompleted(completed) task.setProjectTask(isProjectTask) task.setDescription(description) @@ -513,13 +514,14 @@ Private slot to handle the "New Task" context menu entry. """ from .TaskPropertiesDialog import TaskPropertiesDialog - dlg = TaskPropertiesDialog(None, self, self.projectOpen) + dlg = TaskPropertiesDialog(None, parent=self, + projectOpen=self.projectOpen) if dlg.exec() == QDialog.DialogCode.Accepted: - summary, priority, completed, isProjectTask, description = ( - dlg.getData() - ) + (summary, priority, taskType, completed, isProjectTask, + description) = dlg.getData() self.addTask(summary, priority, completed=completed, - isProjectTask=isProjectTask, description=description) + isProjectTask=isProjectTask, taskType=taskType, + description=description) def __newSubTask(self): """ @@ -529,15 +531,15 @@ projectTask = parentTask.isProjectTask() from .TaskPropertiesDialog import TaskPropertiesDialog - dlg = TaskPropertiesDialog(None, self, self.projectOpen) + dlg = TaskPropertiesDialog(None, parent=self, + projectOpen=self.projectOpen) dlg.setSubTaskMode(projectTask) if dlg.exec() == QDialog.DialogCode.Accepted: - summary, priority, completed, isProjectTask, description = ( - dlg.getData() - ) + (summary, priority, taskType, completed, isProjectTask, + description) = dlg.getData() self.addTask(summary, priority, completed=completed, - isProjectTask=isProjectTask, description=description, - parentTask=parentTask) + isProjectTask=isProjectTask, taskType=taskType, + description=description, parentTask=parentTask) def __markCompleted(self): """