eric6/Tasks/Task.py

Thu, 29 Apr 2021 17:39:17 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 29 Apr 2021 17:39:17 +0200
changeset 8269
87f521f359d5
parent 8240
93b8a353c4bf
child 8278
e647b71b393f
permissions
-rw-r--r--

Modernized some more code and marked code to be modernized.

1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2005 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a class to store task data.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import time
8240
93b8a353c4bf Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
12 import contextlib
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
14 from PyQt5.QtCore import Qt, QUuid
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
15 from PyQt5.QtWidgets import QTreeWidgetItem
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import UI.PixmapCache
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import Preferences
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
8269
87f521f359d5 Modernized some more code and marked code to be modernized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
21 # TODO: separate into Task and TaskItem(QTreeWidgetItem) (eric7)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 class Task(QTreeWidgetItem):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Class implementing the task data structure.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
8269
87f521f359d5 Modernized some more code and marked code to be modernized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
26 # TODO: add Enum for priority
87f521f359d5 Modernized some more code and marked code to be modernized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8240
diff changeset
27 # TODO: convert to Enum
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 TypeNone = -1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 TypeFixme = 0
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 TypeTodo = 1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 TypeWarning = 2
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 TypeNote = 3
7663
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
33 TypeTest = 4
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
34 TypeDocu = 5
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
35
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
36 TaskType2IconName = {
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
37 TypeFixme: "taskFixme",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
38 TypeTodo: "taskTodo",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
39 TypeWarning: "taskWarning",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
40 TypeNote: "taskNote",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
41 TypeTest: "taskTest",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
42 TypeDocu: "taskDocu",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
43 }
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
44 TaskType2ColorName = {
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
45 TypeFixme: "TasksFixmeColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
46 TypeTodo: "TasksTodoColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
47 TypeWarning: "TasksWarningColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
48 TypeNote: "TasksNoteColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
49 TypeTest: "TasksTestColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
50 TypeDocu: "TasksDocuColor",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
51 }
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
52 TaskType2MarkersName = {
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
53 TypeFixme: "TasksFixmeMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
54 TypeTodo: "TasksTodoMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
55 TypeWarning: "TasksWarningMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
56 TypeNote: "TasksNoteMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
57 TypeTest: "TasksTestMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
58 TypeDocu: "TasksDocuMarkers",
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
59 }
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
61 def __init__(self, summary, priority=1, filename="", lineno=0,
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 completed=False, _time=0, isProjectTask=False,
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
63 taskType=TypeTodo, project=None, description="",
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
64 uid="", parentUid=""):
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Constructor
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
68 @param summary summary text of the task (string)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 @param priority priority of the task (0=high, 1=normal, 2=low)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 @param filename filename containing the task (string)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 @param lineno line number containing the task (integer)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 @param completed flag indicating completion status (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @param _time creation time of the task (float, if 0 use current time)
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
74 @param isProjectTask flag indicating a task related to the current
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
75 project (boolean)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 @param taskType type of the task (one of TypeFixme, TypeTodo,
7663
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
77 TypeWarning, TypeNote, TypeTest, TypeDocu)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 @param project reference to the project object (Project)
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
79 @param description explanatory text of the task (string)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
80 @param uid unique id of the task (string)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
81 @param parentUid unique id of the parent task (string)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
83 super().__init__()
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
85 self.summary = summary
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.description = description
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 if priority in [0, 1, 2]:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.priority = priority
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.priority = 1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.filename = filename
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.lineno = lineno
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.completed = completed
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.created = _time and _time or time.time()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self._isProjectTask = isProjectTask
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.taskType = taskType
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.project = project
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
98 if uid:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
99 self.uid = uid
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
100 else:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
101 self.uid = QUuid.createUuid().toString()
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
102 self.parentUid = parentUid
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 if isProjectTask:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.filename = self.project.getRelativePath(self.filename)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
107 self.setData(0, Qt.ItemDataRole.DisplayRole, "")
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
108 self.setData(1, Qt.ItemDataRole.DisplayRole, "")
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
109 self.setData(2, Qt.ItemDataRole.DisplayRole, self.summary)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
110 self.setData(3, Qt.ItemDataRole.DisplayRole, self.filename)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
111 self.setData(4, Qt.ItemDataRole.DisplayRole, self.lineno or "")
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 if self.completed:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
114 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
117 self.setIcon(0, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 for column in range(2, 5):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 f = self.font(column)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 f.setStrikeOut(strikeOut)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.setFont(column, f)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 if self.priority == 1:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
125 self.setIcon(1, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 elif self.priority == 0:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
127 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioHigh"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 elif self.priority == 2:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
129 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
131 self.setIcon(1, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
7663
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
133 try:
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
134 self.setIcon(2, UI.PixmapCache.getIcon(
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
135 Task.TaskType2IconName[self.taskType]))
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
136 except KeyError:
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
137 self.setIcon(2, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 self.colorizeTask()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
140 self.setTextAlignment(4, Qt.AlignmentFlag.AlignRight)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 def colorizeTask(self):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 Public slot to set the colors of the task item.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 boldFont = self.font(0)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 boldFont.setBold(True)
4457
6faeea06e9b6 Fixed a little bug related to styling of a task item.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
148 nonBoldFont = self.font(0)
6faeea06e9b6 Fixed a little bug related to styling of a task item.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
149 nonBoldFont.setBold(False)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 for col in range(5):
8240
93b8a353c4bf Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
151 with contextlib.suppress(KeyError):
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
152 self.setBackground(
7663
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
153 col, Preferences.getTasks(
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
154 Task.TaskType2ColorName[self.taskType]))
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
155
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 if self._isProjectTask:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.setFont(col, boldFont)
4457
6faeea06e9b6 Fixed a little bug related to styling of a task item.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
158 else:
6faeea06e9b6 Fixed a little bug related to styling of a task item.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
159 self.setFont(col, nonBoldFont)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
161 def setSummary(self, summary):
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 Public slot to update the description.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
165 @param summary summary text of the task (string)
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
166 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
167 self.summary = summary
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
168 self.setText(2, self.summary)
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
169
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
170 def setDescription(self, description):
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
171 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
172 Public slot to update the description field.
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
173
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
174 @param description descriptive text of the task (string)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 self.description = description
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 def setPriority(self, priority):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 Public slot to update the priority.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 @param priority priority of the task (0=high, 1=normal, 2=low)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 if priority in [0, 1, 2]:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.priority = priority
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.priority = 1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 if self.priority == 1:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
190 self.setIcon(1, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 elif self.priority == 0:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
192 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioHigh"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 elif self.priority == 2:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
194 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
196 self.setIcon(1, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 def setCompleted(self, completed):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 Public slot to update the completed flag.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 @param completed flag indicating completion status (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.completed = completed
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 if self.completed:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
206 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
209 self.setIcon(0, UI.PixmapCache.getIcon("empty"))
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 for column in range(2, 5):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 f = self.font(column)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 f.setStrikeOut(strikeOut)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.setFont(column, f)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
215
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
216 # set the completion status for all children
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
217 for index in range(self.childCount()):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
218 self.child(index).setCompleted(completed)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 def isCompleted(self):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 Public slot to return the completion status.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 @return flag indicating the completion status (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 return self.completed
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 def getFilename(self):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
230 Public method to retrieve the task's filename.
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 @return filename (string)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 if self._isProjectTask and self.filename:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 return os.path.join(self.project.getProjectPath(), self.filename)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 return self.filename
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
239 def isFileTask(self):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
240 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
241 Public slot to get an indication, if this task is related to a file.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
242
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
243 @return flag indicating a file task (boolean)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
244 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
245 return self.filename != ""
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
246
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 def getLineno(self):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
249 Public method to retrieve the task's linenumber.
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 @return linenumber (integer)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 return self.lineno
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
255 def getUuid(self):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
256 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
257 Public method to get the task's uid.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
258
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
259 @return uid (string)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
260 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
261 return self.uid
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
262
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
263 def getParentUuid(self):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
264 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
265 Public method to get the parent task's uid.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
266
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
267 @return parent uid (string)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
268 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
269 return self.parentUid
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
270
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 def setProjectTask(self, pt):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 Public method to set the project relation flag.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 @param pt flag indicating a project task (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 self._isProjectTask = pt
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 self.colorizeTask()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 def isProjectTask(self):
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 Public slot to return the project relation status.
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 @return flag indicating the project relation status (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 return self._isProjectTask
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
287
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
288 def isProjectFileTask(self):
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
289 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
290 Public slot to get an indication, if this task is related to a
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
291 project file.
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
292
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
293 @return flag indicating a project file task (boolean)
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
294 """
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
295 return self._isProjectTask and self.filename != ""
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
296
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
297 def toDict(self):
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
298 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
299 Public method to convert the task data to a dictionary.
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
300
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
301 @return dictionary containing the task data
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
302 @rtype dict
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
303 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
304 return {
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
305 "summary": self.summary.strip(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
306 "description": self.description.strip(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
307 "priority": self.priority,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
308 "lineno": self.lineno,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
309 "completed": self.completed,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
310 "created": self.created,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
311 "type": self.taskType,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
312 "uid": self.uid,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
313 "parent_uid": self.parentUid,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
314 "expanded": self.isExpanded(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
315 "filename": self.getFilename(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
316 }

eric ide

mercurial