Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
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 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
3 | # Copyright (c) 2005 - 2025 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 | |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
10 | import contextlib |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
11 | import enum |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | import os |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | import time |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
15 | from PyQt6.QtCore import Qt, QUuid |
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
16 | from PyQt6.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
|
17 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
18 | from eric7 import Preferences |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
19 | from eric7.EricGui import EricPixmapCache |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
22 | class TaskType(enum.IntEnum): |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
23 | """ |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
24 | Class defining the task types. |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
25 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
26 | |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
27 | NONE = 255 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
28 | FIXME = 0 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
29 | TODO = 1 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
30 | WARNING = 2 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
31 | NOTE = 3 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
32 | TEST = 4 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
33 | DOCU = 5 |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
34 | |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
35 | |
8280 | 36 | class TaskPriority(enum.IntEnum): |
37 | """ | |
38 | Class defining the task priorities. | |
39 | """ | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | |
8280 | 41 | HIGH = 0 |
42 | NORMAL = 1 | |
43 | LOW = 2 | |
44 | ||
45 | ||
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | 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
|
47 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | 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
|
49 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
7663
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
51 | TaskType2IconName = { |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
52 | TaskType.FIXME: "taskFixme", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | TaskType.TODO: "taskTodo", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | TaskType.WARNING: "taskWarning", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | TaskType.NOTE: "taskNote", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | TaskType.TEST: "taskTest", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | TaskType.DOCU: "taskDocu", # __NO-TASK__ |
7663
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
58 | } |
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
59 | TaskType2ColorName = { |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | TaskType.FIXME: "TasksFixmeColor", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | TaskType.TODO: "TasksTodoColor", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
62 | TaskType.WARNING: "TasksWarningColor", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | TaskType.NOTE: "TasksNoteColor", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
64 | TaskType.TEST: "TasksTestColor", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | TaskType.DOCU: "TasksDocuColor", # __NO-TASK__ |
7663
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
66 | } |
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
67 | TaskType2MarkersName = { |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | TaskType.FIXME: "TasksFixmeMarkers", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | TaskType.TODO: "TasksTodoMarkers", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | TaskType.WARNING: "TasksWarningMarkers", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | TaskType.NOTE: "TasksNoteMarkers", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | TaskType.TEST: "TasksTestMarkers", # __NO-TASK__ |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | TaskType.DOCU: "TasksDocuMarkers", # __NO-TASK__ |
7663
b4d5234f92e7
Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
74 | } |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | def __init__( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | summary, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | priority=TaskPriority.NORMAL, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | filename="", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | lineno=0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | completed=False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | _time=0, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | isProjectTask=False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
85 | taskType=TaskType.TODO, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | project=None, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | description="", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
88 | uid="", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
89 | parentUid="", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | ): |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
93 | |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
94 | @param summary summary text of the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
95 | @type str |
8280 | 96 | @param priority priority of the task |
97 | @type TaskPriority | |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
98 | @param filename filename containing the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
99 | @type str |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
100 | @param lineno line number containing the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
101 | @type int |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
102 | @param completed flag indicating completion status |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
103 | @type bool |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
104 | @param _time creation time of the task (if 0 use current time) |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
105 | @type float |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
106 | @param isProjectTask flag indicating a task related to the current |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
107 | project |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
108 | @type bool |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
109 | @param taskType type of the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
110 | @type TaskType |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
111 | @param project reference to the project object |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
112 | @type Project |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
113 | @param description explanatory text of the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
114 | @type str |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
115 | @param uid unique id of the task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
116 | @type str |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
117 | @param parentUid unique id of the parent task |
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
118 | @type str |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | """ |
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
|
120 | super().__init__() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
122 | 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
|
123 | 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
|
124 | 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
|
125 | 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
|
126 | 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
|
127 | 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
|
128 | 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
|
129 | 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
|
130 | 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
|
131 | 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
|
132 | 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
|
133 | 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
|
134 | self.parentUid = parentUid |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
135 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | if isProjectTask: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | self.filename = self.project.getRelativePath(self.filename) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | |
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
|
139 | 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
|
140 | 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
|
141 | 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
|
142 | 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
|
143 | self.setData(4, Qt.ItemDataRole.DisplayRole, self.lineno or "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
144 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | if self.completed: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
146 | self.setIcon(0, EricPixmapCache.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
|
147 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
149 | self.setIcon(0, EricPixmapCache.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
|
150 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | 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
|
152 | 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
|
153 | 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
|
154 | self.setFont(column, f) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | |
8280 | 156 | self.setPriority(priority) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | |
8280 | 158 | self.setTaskType(taskType) |
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
|
159 | self.setTextAlignment(4, Qt.AlignmentFlag.AlignRight) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | 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
|
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 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
|
164 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 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
|
166 | 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
|
167 | 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
|
168 | 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
|
169 | 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
|
170 | with contextlib.suppress(KeyError): |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3178
diff
changeset
|
171 | self.setBackground( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
172 | col, Preferences.getTasks(Task.TaskType2ColorName[self.taskType]) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
173 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
174 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | 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
|
176 | 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
|
177 | else: |
6faeea06e9b6
Fixed a little bug related to styling of a task item.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
178 | self.setFont(col, nonBoldFont) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
180 | 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
|
181 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | Public slot to update the description. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
183 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
184 | @param summary summary text of the task |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
185 | @type str |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
186 | """ |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
187 | self.summary = summary |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
188 | self.setText(2, self.summary) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
190 | def setDescription(self, description): |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
191 | """ |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
192 | Public slot to update the description field. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | |
8280 | 194 | @param description descriptive text of the task |
195 | @type str | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | self.description = description |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
198 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | 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
|
200 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | Public slot to update the priority. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | |
8280 | 203 | @param priority priority of the task |
204 | @type TaskPriority | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | """ |
8280 | 206 | self.priority = priority |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
207 | |
8280 | 208 | if self.priority == TaskPriority.NORMAL: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
209 | self.setIcon(1, EricPixmapCache.getIcon("empty")) |
8280 | 210 | elif self.priority == TaskPriority.HIGH: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
211 | self.setIcon(1, EricPixmapCache.getIcon("taskPrioHigh")) |
8280 | 212 | elif self.priority == TaskPriority.LOW: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
213 | self.setIcon(1, EricPixmapCache.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
|
214 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
215 | self.setIcon(1, EricPixmapCache.getIcon("empty")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
216 | |
8280 | 217 | def setTaskType(self, taskType): |
218 | """ | |
219 | Public method to update the task type. | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
220 | |
8280 | 221 | @param taskType type of the task |
222 | @type TaskType | |
223 | """ | |
224 | self.taskType = taskType | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
225 | |
8280 | 226 | try: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
227 | self.setIcon( |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
228 | 2, EricPixmapCache.getIcon(Task.TaskType2IconName[self.taskType]) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | ) |
8280 | 230 | except KeyError: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
231 | self.setIcon(2, EricPixmapCache.getIcon("empty")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
232 | |
8280 | 233 | self.colorizeTask() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
234 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | 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
|
236 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | Public slot to update the completed flag. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
239 | @param completed flag indicating completion status |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
240 | @type bool |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | 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
|
243 | if self.completed: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
244 | self.setIcon(0, EricPixmapCache.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
|
245 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | else: |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
247 | self.setIcon(0, EricPixmapCache.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
|
248 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | 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
|
250 | 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
|
251 | 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
|
252 | self.setFont(column, f) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
253 | |
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
|
254 | # 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
|
255 | 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
|
256 | self.child(index).setCompleted(completed) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
257 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | 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
|
259 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | Public slot to return the completion status. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
262 | @return flag indicating the completion status |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
263 | @rtype bool |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | return self.completed |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | 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
|
268 | """ |
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
|
269 | Public method to retrieve the task's filename. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
271 | @return filename |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
272 | @rtype str |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | 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
|
275 | 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
|
276 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | return self.filename |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
278 | |
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
|
279 | 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
|
280 | """ |
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
|
281 | Public slot to get an indication, if this task is related to a file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
282 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
283 | @return flag indicating a file task |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
284 | @rtype bool |
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
|
285 | """ |
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
|
286 | return self.filename != "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
287 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | 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
|
289 | """ |
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
|
290 | Public method to retrieve the task's linenumber. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
291 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
292 | @return linenumber |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
293 | @rtype int |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | return self.lineno |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
296 | |
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
|
297 | 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
|
298 | """ |
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
|
299 | Public method to get the task's uid. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
300 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
301 | @return uid |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
302 | @rtype str |
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
|
303 | """ |
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
|
304 | return self.uid |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
305 | |
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
|
306 | 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
|
307 | """ |
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
|
308 | Public method to get the parent task's uid. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
309 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
310 | @return parent uid |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
311 | @rtype str |
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
|
312 | """ |
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
|
313 | return self.parentUid |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
314 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | 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
|
316 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | Public method to set the project relation flag. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
318 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
319 | @param pt flag indicating a project task |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
320 | @type bool |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | 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
|
323 | self.colorizeTask() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
324 | |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | 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
|
326 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | Public slot to return the project relation status. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
328 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
329 | @return flag indicating the project relation status |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
330 | @rtype bool |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | return self._isProjectTask |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
333 | |
2000
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
334 | def isProjectFileTask(self): |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
335 | """ |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
336 | 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
|
337 | project file. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
338 | |
10431
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
339 | @return flag indicating a project file task |
64157aeb0312
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
340 | @rtype bool |
2000
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
341 | """ |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
342 | return self._isProjectTask and self.filename != "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
343 | |
8011
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
344 | def toDict(self): |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
345 | """ |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
346 | Public method to convert the task data to a dictionary. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
347 | |
8011
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
348 | @return dictionary containing the task data |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
349 | @rtype dict |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
350 | """ |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
351 | return { |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
352 | "summary": self.summary.strip(), |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
353 | "description": self.description.strip(), |
8280 | 354 | "priority": self.priority.value, |
8011
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
355 | "lineno": self.lineno, |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
356 | "completed": self.completed, |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
357 | "created": self.created, |
8278
e647b71b393f
Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8269
diff
changeset
|
358 | "type": self.taskType.value, |
8011
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
359 | "uid": self.uid, |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
360 | "parent_uid": self.parentUid, |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
361 | "expanded": self.isExpanded(), |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
362 | "filename": self.getFilename(), |
630a173cb137
Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
363 | } |