Tasks/Task.py

Wed, 01 Jan 2014 14:38:45 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 01 Jan 2014 14:38:45 +0100
changeset 3160
209a07d7e401
parent 2997
7f0ef975da9e
child 3178
f25fc1364c88
permissions
-rw-r--r--

Updated copyright for 2014.

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
3160
209a07d7e401 Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
3 # Copyright (c) 2005 - 2014 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
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
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
30 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
31 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
32 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
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
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
36 @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
37 @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
38 @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
39 @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
40 @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
41 @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
42 @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
43 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
44 @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
45 TypeWarning, TypeNote)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 @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
47 @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
48 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 super().__init__()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
51 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
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 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
54 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
55 else:
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 = 1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 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
58 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
59 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
60 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
61 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
62 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
63 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
64
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 if isProjectTask:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 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
67
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 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
69 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
70 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
71 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
72 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
73
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 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
75 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
76 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 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
79 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 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
81 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
82 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
83 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
84
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 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
86 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
87 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
88 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
89 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
90 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
91 else:
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("empty.png"))
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 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
95 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
96 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
97 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
98 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
99 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
100 else:
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("taskNote.png"))
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 self.colorizeTask()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 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
105
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 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
107 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 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
109 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 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
111 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
112 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
113 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
114 self.setBackgroundColor(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
115 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
116 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
117 self.setBackgroundColor(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
118 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
119 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
120 self.setBackgroundColor(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
121 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
122 else:
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
123 self.setBackgroundColor(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
124 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
125 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
126 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
127
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
128 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
129 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 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
131
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
132 @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
133 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
134 self.summary = summary
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
135 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
136
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
137 def setDescription(self, description):
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 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
140
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
141 @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
142 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 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
144
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 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
146 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 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
148
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 @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
150 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 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
152 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
153 else:
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 = 1
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 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
157 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
158 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
159 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
160 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
161 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
162 else:
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("empty.png"))
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 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
166 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 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
168
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 @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
170 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 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
172 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
173 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
174 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 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
177 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 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
179 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
180 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
181 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
182
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 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
184 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 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
186
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 @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
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 self.completed
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 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
192 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 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
194
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 @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
196 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 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
198 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
199 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 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
201
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 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
203 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 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
205
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 @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
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 self.lineno
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 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
211 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 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
213
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 @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
215 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 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
217 self.colorizeTask()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 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
220 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 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
222
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 @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
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 self._isProjectTask
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
226
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
227 def isProjectFileTask(self):
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
228 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
229 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
230 project file.
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
231
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
232 @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
233 """
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
234 return self._isProjectTask and self.filename != ""

eric ide

mercurial