Sun, 12 Aug 2012 13:42:23 +0200
Fixed an issue with the task manager.
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 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2005 - 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a class to store task data. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | import os |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import time |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from PyQt4.QtCore import Qt |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | from PyQt4.QtGui import QTreeWidgetItem |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | import UI.PixmapCache |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | import Preferences |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | 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
|
21 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | 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
|
23 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | TypeNone = -1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | TypeFixme = 0 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | TypeTodo = 1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | TypeWarning = 2 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | TypeNote = 3 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | def __init__(self, description, priority=1, filename="", lineno=0, |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | completed=False, _time=0, isProjectTask=False, |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | taskType=TypeTodo, project=None, longtext=""): |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | Constructor |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | @param parent parent widget of the task (QWidget) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | @param description descriptive text of the task (string) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | @param priority priority of the task (0=high, 1=normal, 2=low) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @param filename filename containing the task (string) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | @param lineno line number containing the task (integer) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | @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
|
42 | @param _time creation time of the task (float, if 0 use current time) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | @param isProjectTask flag indicating a task related to the current project |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | (boolean) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | @param taskType type of the task (one of TypeFixme, TypeTodo, |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | TypeWarning, TypeNote) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | @param project reference to the project object (Project) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | @param longtext explanatory text of the task (string) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | super().__init__() |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | 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
|
53 | self.longtext = longtext |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | if priority in [0, 1, 2]: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | self.priority = priority |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.priority = 1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | 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
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | self.taskType = taskType |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | self.project = project |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | if isProjectTask: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.filename = self.project.getRelativePath(self.filename) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.setData(0, Qt.DisplayRole, "") |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | self.setData(1, Qt.DisplayRole, "") |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | self.setData(2, Qt.DisplayRole, self.description) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | self.setData(3, Qt.DisplayRole, self.filename) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | self.setData(4, Qt.DisplayRole, self.lineno or "") |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | if self.completed: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.setIcon(0, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | 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
|
82 | 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
|
83 | 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
|
84 | self.setFont(column, f) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | if self.priority == 1: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.setIcon(1, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | elif self.priority == 0: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.setIcon(1, UI.PixmapCache.getIcon("taskPrioHigh.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | elif self.priority == 2: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | self.setIcon(1, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | if self.taskType == Task.TypeFixme: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | self.setIcon(2, UI.PixmapCache.getIcon("taskFixme.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | elif self.taskType == Task.TypeWarning: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.setIcon(2, UI.PixmapCache.getIcon("taskWarning.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | elif self.taskType == Task.TypeTodo: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | self.setIcon(2, UI.PixmapCache.getIcon("taskTodo.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.setIcon(2, UI.PixmapCache.getIcon("taskNote.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.colorizeTask() |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.setTextAlignment(4, Qt.AlignRight) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | 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
|
108 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | 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
|
110 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | 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
|
112 | boldFont.setBold(True) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | for col in range(5): |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | if self.taskType == Task.TypeFixme: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | self.setBackgroundColor(col, Preferences.getTasks("TasksFixmeColor")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | elif self.taskType == Task.TypeWarning: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | self.setBackgroundColor(col, Preferences.getTasks("TasksWarningColor")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | elif self.taskType == Task.TypeTodo: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.setBackgroundColor(col, Preferences.getTasks("TasksTodoColor")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | self.setBackgroundColor(col, Preferences.getTasks("TasksNoteColor")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | 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
|
123 | self.setFont(col, boldFont) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | def setDescription(self, description): |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | Public slot to update the description. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | @param longtext explanatory text of the task (string) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | 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
|
132 | self.setText(2, self.description) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | def setLongText(self, longtext): |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | Public slot to update the longtext field. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | @param longtext descriptive text of the task (string) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | self.longtext = longtext |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | def 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
|
143 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | Public slot to update the priority. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | @param priority priority of the task (0=high, 1=normal, 2=low) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | if priority in [0, 1, 2]: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | self.priority = priority |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | self.priority = 1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | if self.priority == 1: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | self.setIcon(1, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | elif self.priority == 0: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | self.setIcon(1, UI.PixmapCache.getIcon("taskPrioHigh.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | elif self.priority == 2: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | self.setIcon(1, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | 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
|
163 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | Public slot to update the completed flag. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | @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
|
167 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | 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
|
169 | if self.completed: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | self.setIcon(0, UI.PixmapCache.getIcon("empty.png")) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | 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
|
176 | 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
|
177 | 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
|
178 | self.setFont(column, f) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | 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
|
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 return the completion status. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
183 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | @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
|
185 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | return self.completed |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | 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
|
189 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | Public method to retrieve the tasks filename. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | @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
|
193 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | 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
|
195 | 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
|
196 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | return self.filename |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | 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
|
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 method to retrieve the tasks linenumber. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | @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
|
204 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | return self.lineno |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | 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
|
208 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | Public method to set the project relation flag. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | @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
|
212 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | 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
|
214 | self.colorizeTask() |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | 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
|
217 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | Public slot to return the project relation status. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | @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
|
221 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | return self._isProjectTask |
2000
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
223 | |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
224 | def isProjectFileTask(self): |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
225 | """ |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
226 | Public slot to get an indication, if this task is related to a project file. |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
227 | |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
228 | @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
|
229 | """ |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
230 | return self._isProjectTask and self.filename != "" |