src/eric7/Tasks/Task.py

Tue, 18 Oct 2022 16:06:21 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 18 Oct 2022 16:06:21 +0200
branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
permissions
-rw-r--r--

Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.

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
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8410
diff changeset
3 # Copyright (c) 2005 - 2022 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
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
18 from eric7.EricGui import EricPixmapCache
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 import Preferences
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
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
36 class TaskPriority(enum.IntEnum):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
37 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
38 Class defining the task priorities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
39 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
41 HIGH = 0
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
42 NORMAL = 1
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
43 LOW = 2
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
44
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
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
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
96 @param priority priority of the task
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
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
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
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
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
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
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
184 @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
185 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
186 self.summary = summary
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
187 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
188
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
189 def setDescription(self, description):
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
190 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
191 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
192
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
193 @param description descriptive text of the task
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
194 @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
195 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 self.description = description
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 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
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 priority.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
201
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
202 @param priority priority of the task
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
203 @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
204 """
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
205 self.priority = priority
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
206
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
207 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
208 self.setIcon(1, EricPixmapCache.getIcon("empty"))
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
209 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
210 self.setIcon(1, EricPixmapCache.getIcon("taskPrioHigh"))
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
211 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
212 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
213 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
214 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
215
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
216 def setTaskType(self, taskType):
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
217 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
218 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
219
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
220 @param taskType type of the task
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
221 @type TaskType
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
222 """
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
223 self.taskType = taskType
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
224
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
225 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
226 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
227 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
228 )
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
229 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
230 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
231
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
232 self.colorizeTask()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
233
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 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
235 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 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
237
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 @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
239 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 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
241 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
242 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
243 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 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
245 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
246 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 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
248 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
249 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
250 self.setFont(column, f)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251
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
252 # 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
253 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
254 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
255
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 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
257 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 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
259
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 @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
261 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 return self.completed
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
263
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 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
265 """
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
266 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
267
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 @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
269 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 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
271 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
272 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 return self.filename
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
274
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
275 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
276 """
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
277 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
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 @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
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 return self.filename != ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
282
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 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
284 """
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 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
286
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 @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
288 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 return self.lineno
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
290
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
291 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
292 """
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
293 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
294
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
295 @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
296 """
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 return self.uid
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
298
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
299 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
300 """
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
301 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
302
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 @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
304 """
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
305 return self.parentUid
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
306
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 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
308 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 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
310
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 @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
312 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 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
314 self.colorizeTask()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
315
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 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
317 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 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
319
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 @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
321 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 return self._isProjectTask
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
323
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
324 def isProjectFileTask(self):
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
325 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
326 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
327 project file.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
328
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
329 @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
330 """
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
331 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
332
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
333 def toDict(self):
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
334 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
335 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
336
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
337 @return dictionary containing the task data
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
338 @rtype dict
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
339 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
340 return {
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
341 "summary": self.summary.strip(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
342 "description": self.description.strip(),
8280
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8278
diff changeset
343 "priority": self.priority.value,
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
344 "lineno": self.lineno,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
345 "completed": self.completed,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
346 "created": self.created,
8278
e647b71b393f Modernized some more code (Tasks).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8269
diff changeset
347 "type": self.taskType.value,
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
348 "uid": self.uid,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
349 "parent_uid": self.parentUid,
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
350 "expanded": self.isExpanded(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
351 "filename": self.getFilename(),
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
352 }

eric ide

mercurial