Fri, 18 Oct 2013 23:00:41 +0200
Merge with default branch after shorten the code lines to max. 79 characters.
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 | |
2302
f29e9405c851
Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2197
diff
changeset
|
3 | # Copyright (c) 2005 - 2013 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 | |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
10 | from __future__ import unicode_literals # __IGNORE_WARNING__ |
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
11 | |
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 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | 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
|
16 | 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
|
17 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | 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
|
19 | import Preferences |
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 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | class Task(QTreeWidgetItem): |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | Class implementing the task data structure. |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | TypeNone = -1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | TypeFixme = 0 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | TypeTodo = 1 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | TypeWarning = 2 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | TypeNote = 3 |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
32 | def __init__(self, summary, priority=1, filename="", lineno=0, |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | completed=False, _time=0, isProjectTask=False, |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
34 | taskType=TypeTodo, project=None, description=""): |
1819
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 | Constructor |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
38 | @param summary summary text of the task (string) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | @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
|
40 | @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
|
41 | @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
|
42 | @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
|
43 | @param _time creation time of the task (float, if 0 use current time) |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
44 | @param isProjectTask flag indicating a task related to the current |
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
45 | project (boolean) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | @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
|
47 | TypeWarning, TypeNote) |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | @param project reference to the project object (Project) |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
49 | @param description explanatory text of the task (string) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
51 | super(Task, self).__init__() |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
53 | 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
|
54 | 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
|
55 | 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
|
56 | 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
|
57 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | 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
|
59 | 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
|
60 | 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
|
61 | 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
|
62 | 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
|
63 | 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
|
64 | 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
|
65 | 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
|
66 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | if isProjectTask: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | 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
|
69 | |
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(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
|
71 | self.setData(1, Qt.DisplayRole, "") |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
72 | self.setData(2, Qt.DisplayRole, 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
|
73 | 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
|
74 | 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
|
75 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | 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
|
77 | 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
|
78 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | 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
|
81 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | 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
|
83 | 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
|
84 | 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
|
85 | 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
|
86 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | 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
|
88 | 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
|
89 | 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
|
90 | 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
|
91 | 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
|
92 | 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
|
93 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | 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
|
95 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | 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
|
97 | 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | 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
|
102 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | 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
|
104 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.colorizeTask() |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | 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
|
107 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | 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
|
109 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | 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
|
111 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | 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
|
113 | 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
|
114 | 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
|
115 | if self.taskType == Task.TypeFixme: |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
116 | self.setBackgroundColor( |
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
117 | col, Preferences.getTasks("TasksFixmeColor")) |
1819
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.TypeWarning: |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
119 | self.setBackgroundColor( |
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
120 | col, Preferences.getTasks("TasksWarningColor")) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | elif self.taskType == Task.TypeTodo: |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
122 | self.setBackgroundColor( |
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
123 | col, Preferences.getTasks("TasksTodoColor")) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | else: |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
125 | self.setBackgroundColor( |
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
126 | col, Preferences.getTasks("TasksNoteColor")) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | 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
|
128 | 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
|
129 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
130 | 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
|
131 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | 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
|
133 | |
2197
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
134 | @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
|
135 | """ |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
136 | self.summary = summary |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
137 | self.setText(2, self.summary) |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
138 | |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
139 | def setDescription(self, description): |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
140 | """ |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
141 | Public slot to update the description field. |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
142 | |
c4f24f8f34c0
Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2000
diff
changeset
|
143 | @param description descriptive text of the task (string) |
1819
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | 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
|
146 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | 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
|
148 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | 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
|
150 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | @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
|
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 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
|
154 | 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
|
155 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | 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
|
157 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | 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
|
159 | 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
|
160 | 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
|
161 | 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
|
162 | 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
|
163 | 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
|
164 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 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
|
166 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | 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
|
168 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | 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
|
170 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | @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
|
172 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | strikeOut = True |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | 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
|
179 | strikeOut = False |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | 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
|
186 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | 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
|
188 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | @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
|
190 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | 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
|
192 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | 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
|
194 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | 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
|
196 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | @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
|
198 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | 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
|
200 | 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
|
201 | else: |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | 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
|
203 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | 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
|
205 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | 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
|
207 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | @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
|
209 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | 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
|
211 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | 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
|
213 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | 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
|
215 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | @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
|
217 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | 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
|
219 | self.colorizeTask() |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | 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
|
222 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | 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
|
224 | |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | @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
|
226 | """ |
cfcfd617216a
Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | return self._isProjectTask |
2000
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
228 | |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
229 | def isProjectFileTask(self): |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
230 | """ |
2997
7f0ef975da9e
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
231 | 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
|
232 | project file. |
2000
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
233 | |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
234 | @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
|
235 | """ |
a81bf687e4ee
Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1819
diff
changeset
|
236 | return self._isProjectTask and self.filename != "" |