Tasks/Task.py

changeset 2197
c4f24f8f34c0
parent 2000
a81bf687e4ee
child 2302
f29e9405c851
equal deleted inserted replaced
2196:b5ca7665e928 2197:c4f24f8f34c0
25 TypeFixme = 0 25 TypeFixme = 0
26 TypeTodo = 1 26 TypeTodo = 1
27 TypeWarning = 2 27 TypeWarning = 2
28 TypeNote = 3 28 TypeNote = 3
29 29
30 def __init__(self, description, priority=1, filename="", lineno=0, 30 def __init__(self, summary, priority=1, filename="", lineno=0,
31 completed=False, _time=0, isProjectTask=False, 31 completed=False, _time=0, isProjectTask=False,
32 taskType=TypeTodo, project=None, longtext=""): 32 taskType=TypeTodo, project=None, description=""):
33 """ 33 """
34 Constructor 34 Constructor
35 35
36 @param parent parent widget of the task (QWidget) 36 @param parent parent widget of the task (QWidget)
37 @param description descriptive text of the task (string) 37 @param summary summary text of the task (string)
38 @param priority priority of the task (0=high, 1=normal, 2=low) 38 @param priority priority of the task (0=high, 1=normal, 2=low)
39 @param filename filename containing the task (string) 39 @param filename filename containing the task (string)
40 @param lineno line number containing the task (integer) 40 @param lineno line number containing the task (integer)
41 @param completed flag indicating completion status (boolean) 41 @param completed flag indicating completion status (boolean)
42 @param _time creation time of the task (float, if 0 use current time) 42 @param _time creation time of the task (float, if 0 use current time)
43 @param isProjectTask flag indicating a task related to the current project 43 @param isProjectTask flag indicating a task related to the current project
44 (boolean) 44 (boolean)
45 @param taskType type of the task (one of TypeFixme, TypeTodo, 45 @param taskType type of the task (one of TypeFixme, TypeTodo,
46 TypeWarning, TypeNote) 46 TypeWarning, TypeNote)
47 @param project reference to the project object (Project) 47 @param project reference to the project object (Project)
48 @param longtext explanatory text of the task (string) 48 @param description explanatory text of the task (string)
49 """ 49 """
50 super().__init__() 50 super().__init__()
51 51
52 self.summary = summary
52 self.description = description 53 self.description = description
53 self.longtext = longtext
54 if priority in [0, 1, 2]: 54 if priority in [0, 1, 2]:
55 self.priority = priority 55 self.priority = priority
56 else: 56 else:
57 self.priority = 1 57 self.priority = 1
58 self.filename = filename 58 self.filename = filename
66 if isProjectTask: 66 if isProjectTask:
67 self.filename = self.project.getRelativePath(self.filename) 67 self.filename = self.project.getRelativePath(self.filename)
68 68
69 self.setData(0, Qt.DisplayRole, "") 69 self.setData(0, Qt.DisplayRole, "")
70 self.setData(1, Qt.DisplayRole, "") 70 self.setData(1, Qt.DisplayRole, "")
71 self.setData(2, Qt.DisplayRole, self.description) 71 self.setData(2, Qt.DisplayRole, self.summary)
72 self.setData(3, Qt.DisplayRole, self.filename) 72 self.setData(3, Qt.DisplayRole, self.filename)
73 self.setData(4, Qt.DisplayRole, self.lineno or "") 73 self.setData(4, Qt.DisplayRole, self.lineno or "")
74 74
75 if self.completed: 75 if self.completed:
76 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png")) 76 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png"))
120 else: 120 else:
121 self.setBackgroundColor(col, Preferences.getTasks("TasksNoteColor")) 121 self.setBackgroundColor(col, Preferences.getTasks("TasksNoteColor"))
122 if self._isProjectTask: 122 if self._isProjectTask:
123 self.setFont(col, boldFont) 123 self.setFont(col, boldFont)
124 124
125 def setSummary(self, summary):
126 """
127 Public slot to update the description.
128
129 @param summary summary text of the task (string)
130 """
131 self.summary = summary
132 self.setText(2, self.summary)
133
125 def setDescription(self, description): 134 def setDescription(self, description):
126 """ 135 """
127 Public slot to update the description. 136 Public slot to update the description field.
128 137
129 @param longtext explanatory text of the task (string) 138 @param description descriptive text of the task (string)
130 """ 139 """
131 self.description = description 140 self.description = description
132 self.setText(2, self.description)
133
134 def setLongText(self, longtext):
135 """
136 Public slot to update the longtext field.
137
138 @param longtext descriptive text of the task (string)
139 """
140 self.longtext = longtext
141 141
142 def setPriority(self, priority): 142 def setPriority(self, priority):
143 """ 143 """
144 Public slot to update the priority. 144 Public slot to update the priority.
145 145

eric ide

mercurial