25 TypeNone = -1 |
25 TypeNone = -1 |
26 TypeFixme = 0 |
26 TypeFixme = 0 |
27 TypeTodo = 1 |
27 TypeTodo = 1 |
28 TypeWarning = 2 |
28 TypeWarning = 2 |
29 TypeNote = 3 |
29 TypeNote = 3 |
|
30 TypeTest = 4 |
|
31 TypeDocu = 5 |
|
32 |
|
33 TaskType2IconName = { |
|
34 TypeFixme: "taskFixme", |
|
35 TypeTodo: "taskTodo", |
|
36 TypeWarning: "taskWarning", |
|
37 TypeNote: "taskNote", |
|
38 TypeTest: "taskTest", |
|
39 TypeDocu: "taskDocu", |
|
40 } |
|
41 TaskType2ColorName = { |
|
42 TypeFixme: "TasksFixmeColor", |
|
43 TypeTodo: "TasksTodoColor", |
|
44 TypeWarning: "TasksWarningColor", |
|
45 TypeNote: "TasksNoteColor", |
|
46 TypeTest: "TasksTestColor", |
|
47 TypeDocu: "TasksDocuColor", |
|
48 } |
|
49 TaskType2MarkersName = { |
|
50 TypeFixme: "TasksFixmeMarkers", |
|
51 TypeTodo: "TasksTodoMarkers", |
|
52 TypeWarning: "TasksWarningMarkers", |
|
53 TypeNote: "TasksNoteMarkers", |
|
54 TypeTest: "TasksTestMarkers", |
|
55 TypeDocu: "TasksDocuMarkers", |
|
56 } |
30 |
57 |
31 def __init__(self, summary, priority=1, filename="", lineno=0, |
58 def __init__(self, summary, priority=1, filename="", lineno=0, |
32 completed=False, _time=0, isProjectTask=False, |
59 completed=False, _time=0, isProjectTask=False, |
33 taskType=TypeTodo, project=None, description="", |
60 taskType=TypeTodo, project=None, description="", |
34 uid="", parentUid=""): |
61 uid="", parentUid=""): |
42 @param completed flag indicating completion status (boolean) |
69 @param completed flag indicating completion status (boolean) |
43 @param _time creation time of the task (float, if 0 use current time) |
70 @param _time creation time of the task (float, if 0 use current time) |
44 @param isProjectTask flag indicating a task related to the current |
71 @param isProjectTask flag indicating a task related to the current |
45 project (boolean) |
72 project (boolean) |
46 @param taskType type of the task (one of TypeFixme, TypeTodo, |
73 @param taskType type of the task (one of TypeFixme, TypeTodo, |
47 TypeWarning, TypeNote) |
74 TypeWarning, TypeNote, TypeTest, TypeDocu) |
48 @param project reference to the project object (Project) |
75 @param project reference to the project object (Project) |
49 @param description explanatory text of the task (string) |
76 @param description explanatory text of the task (string) |
50 @param uid unique id of the task (string) |
77 @param uid unique id of the task (string) |
51 @param parentUid unique id of the parent task (string) |
78 @param parentUid unique id of the parent task (string) |
52 """ |
79 """ |
98 elif self.priority == 2: |
125 elif self.priority == 2: |
99 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow")) |
126 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow")) |
100 else: |
127 else: |
101 self.setIcon(1, UI.PixmapCache.getIcon("empty")) |
128 self.setIcon(1, UI.PixmapCache.getIcon("empty")) |
102 |
129 |
103 if self.taskType == Task.TypeFixme: |
130 try: |
104 self.setIcon(2, UI.PixmapCache.getIcon("taskFixme")) |
131 self.setIcon(2, UI.PixmapCache.getIcon( |
105 elif self.taskType == Task.TypeWarning: |
132 Task.TaskType2IconName[self.taskType])) |
106 self.setIcon(2, UI.PixmapCache.getIcon("taskWarning")) |
133 except KeyError: |
107 elif self.taskType == Task.TypeTodo: |
134 self.setIcon(2, UI.PixmapCache.getIcon("empty")) |
108 self.setIcon(2, UI.PixmapCache.getIcon("taskTodo")) |
|
109 else: |
|
110 self.setIcon(2, UI.PixmapCache.getIcon("taskNote")) |
|
111 |
135 |
112 self.colorizeTask() |
136 self.colorizeTask() |
113 self.setTextAlignment(4, Qt.AlignRight) |
137 self.setTextAlignment(4, Qt.AlignRight) |
114 |
138 |
115 def colorizeTask(self): |
139 def colorizeTask(self): |
119 boldFont = self.font(0) |
143 boldFont = self.font(0) |
120 boldFont.setBold(True) |
144 boldFont.setBold(True) |
121 nonBoldFont = self.font(0) |
145 nonBoldFont = self.font(0) |
122 nonBoldFont.setBold(False) |
146 nonBoldFont.setBold(False) |
123 for col in range(5): |
147 for col in range(5): |
124 if self.taskType == Task.TypeFixme: |
148 try: |
125 self.setBackground( |
149 self.setBackground( |
126 col, Preferences.getTasks("TasksFixmeColor")) |
150 col, Preferences.getTasks( |
127 elif self.taskType == Task.TypeWarning: |
151 Task.TaskType2ColorName[self.taskType])) |
128 self.setBackground( |
152 except KeyError: |
129 col, Preferences.getTasks("TasksWarningColor")) |
153 # do not set background color if type is not known |
130 elif self.taskType == Task.TypeTodo: |
154 pass |
131 self.setBackground( |
155 |
132 col, Preferences.getTasks("TasksTodoColor")) |
|
133 else: |
|
134 self.setBackground( |
|
135 col, Preferences.getTasks("TasksNoteColor")) |
|
136 if self._isProjectTask: |
156 if self._isProjectTask: |
137 self.setFont(col, boldFont) |
157 self.setFont(col, boldFont) |
138 else: |
158 else: |
139 self.setFont(col, nonBoldFont) |
159 self.setFont(col, nonBoldFont) |
140 |
160 |