Tasks/Task.py

Mon, 25 Mar 2013 03:11:06 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Mon, 25 Mar 2013 03:11:06 +0100
branch
Py2 comp.
changeset 2525
8b507a9a2d40
parent 2302
f29e9405c851
child 3057
10516539f238
permissions
-rw-r--r--

Script changes: Future import added, super calls modified and unicode behavior for str.

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
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param parent parent widget of the task (QWidget)
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
39 @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
40 @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
41 @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
42 @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
43 @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
44 @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
45 @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
46 (boolean)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @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
48 TypeWarning, TypeNote)
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @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
50 @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
51 """
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
52 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
53
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
54 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
55 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
56 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
57 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
58 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 if isProjectTask:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 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
70
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(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
72 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
73 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
74 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
75 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
76
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 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
78 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
79 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 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
82 strikeOut = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 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
84 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
85 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
86 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
87
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 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
89 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
90 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
91 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
92 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
93 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
94 else:
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(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
96
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 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
98 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
99 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
100 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
101 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
102 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
103 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 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
105
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.colorizeTask()
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 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
108
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 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
110 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 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
112 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120 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
121 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
122 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 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
124 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
125 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
126
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
127 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
128 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 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
130
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
131 @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
132 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
133 self.summary = summary
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
134 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
135
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
136 def setDescription(self, description):
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
137 """
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
138 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
139
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
140 @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
141 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 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
143
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 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
145 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 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
147
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 @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
149 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 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
151 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
152 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 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
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 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
156 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
157 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
158 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
159 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
160 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
161 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 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
163
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 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
165 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 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
167
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 @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
169 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 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
171 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
172 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
173 strikeOut = True
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 else:
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("empty.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 = False
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 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
178 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
179 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
180 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
181
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 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
183 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 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
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 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
187 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 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
189
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 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
191 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 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
193
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 @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
195 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 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
197 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
198 else:
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 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
200
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 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
202 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 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
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 linenumber (integer)
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 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
208
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 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
210 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 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
212
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 @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
214 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 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
216 self.colorizeTask()
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 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
219 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 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
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 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
223 """
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 return self._isProjectTask
2000
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 def isProjectFileTask(self):
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 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
229
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
230 @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
231 """
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
232 return self._isProjectTask and self.filename != ""

eric ide

mercurial