src/eric7/Tasks/Task.py

branch
eric7
changeset 9413
80c06d472826
parent 9221
bf71ee032bb4
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9412:45e7bb09c120 9413:80c06d472826
13 import time 13 import time
14 14
15 from PyQt6.QtCore import Qt, QUuid 15 from PyQt6.QtCore import Qt, QUuid
16 from PyQt6.QtWidgets import QTreeWidgetItem 16 from PyQt6.QtWidgets import QTreeWidgetItem
17 17
18 import UI.PixmapCache 18 from eric7.EricGui import EricPixmapCache
19 import Preferences 19 from eric7 import Preferences
20 20
21 21
22 class TaskType(enum.IntEnum): 22 class TaskType(enum.IntEnum):
23 """ 23 """
24 Class defining the task types. 24 Class defining the task types.
141 self.setData(2, Qt.ItemDataRole.DisplayRole, self.summary) 141 self.setData(2, Qt.ItemDataRole.DisplayRole, self.summary)
142 self.setData(3, Qt.ItemDataRole.DisplayRole, self.filename) 142 self.setData(3, Qt.ItemDataRole.DisplayRole, self.filename)
143 self.setData(4, Qt.ItemDataRole.DisplayRole, self.lineno or "") 143 self.setData(4, Qt.ItemDataRole.DisplayRole, self.lineno or "")
144 144
145 if self.completed: 145 if self.completed:
146 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted")) 146 self.setIcon(0, EricPixmapCache.getIcon("taskCompleted"))
147 strikeOut = True 147 strikeOut = True
148 else: 148 else:
149 self.setIcon(0, UI.PixmapCache.getIcon("empty")) 149 self.setIcon(0, EricPixmapCache.getIcon("empty"))
150 strikeOut = False 150 strikeOut = False
151 for column in range(2, 5): 151 for column in range(2, 5):
152 f = self.font(column) 152 f = self.font(column)
153 f.setStrikeOut(strikeOut) 153 f.setStrikeOut(strikeOut)
154 self.setFont(column, f) 154 self.setFont(column, f)
203 @type TaskPriority 203 @type TaskPriority
204 """ 204 """
205 self.priority = priority 205 self.priority = priority
206 206
207 if self.priority == TaskPriority.NORMAL: 207 if self.priority == TaskPriority.NORMAL:
208 self.setIcon(1, UI.PixmapCache.getIcon("empty")) 208 self.setIcon(1, EricPixmapCache.getIcon("empty"))
209 elif self.priority == TaskPriority.HIGH: 209 elif self.priority == TaskPriority.HIGH:
210 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioHigh")) 210 self.setIcon(1, EricPixmapCache.getIcon("taskPrioHigh"))
211 elif self.priority == TaskPriority.LOW: 211 elif self.priority == TaskPriority.LOW:
212 self.setIcon(1, UI.PixmapCache.getIcon("taskPrioLow")) 212 self.setIcon(1, EricPixmapCache.getIcon("taskPrioLow"))
213 else: 213 else:
214 self.setIcon(1, UI.PixmapCache.getIcon("empty")) 214 self.setIcon(1, EricPixmapCache.getIcon("empty"))
215 215
216 def setTaskType(self, taskType): 216 def setTaskType(self, taskType):
217 """ 217 """
218 Public method to update the task type. 218 Public method to update the task type.
219 219
222 """ 222 """
223 self.taskType = taskType 223 self.taskType = taskType
224 224
225 try: 225 try:
226 self.setIcon( 226 self.setIcon(
227 2, UI.PixmapCache.getIcon(Task.TaskType2IconName[self.taskType]) 227 2, EricPixmapCache.getIcon(Task.TaskType2IconName[self.taskType])
228 ) 228 )
229 except KeyError: 229 except KeyError:
230 self.setIcon(2, UI.PixmapCache.getIcon("empty")) 230 self.setIcon(2, EricPixmapCache.getIcon("empty"))
231 231
232 self.colorizeTask() 232 self.colorizeTask()
233 233
234 def setCompleted(self, completed): 234 def setCompleted(self, completed):
235 """ 235 """
237 237
238 @param completed flag indicating completion status (boolean) 238 @param completed flag indicating completion status (boolean)
239 """ 239 """
240 self.completed = completed 240 self.completed = completed
241 if self.completed: 241 if self.completed:
242 self.setIcon(0, UI.PixmapCache.getIcon("taskCompleted")) 242 self.setIcon(0, EricPixmapCache.getIcon("taskCompleted"))
243 strikeOut = True 243 strikeOut = True
244 else: 244 else:
245 self.setIcon(0, UI.PixmapCache.getIcon("empty")) 245 self.setIcon(0, EricPixmapCache.getIcon("empty"))
246 strikeOut = False 246 strikeOut = False
247 for column in range(2, 5): 247 for column in range(2, 5):
248 f = self.font(column) 248 f = self.font(column)
249 f.setStrikeOut(strikeOut) 249 f.setStrikeOut(strikeOut)
250 self.setFont(column, f) 250 self.setFont(column, f)

eric ide

mercurial