31 """ |
31 """ |
32 Class implementing the task data structure. |
32 Class implementing the task data structure. |
33 """ |
33 """ |
34 def __init__(self, description, priority = 1, filename = "", lineno = 0, |
34 def __init__(self, description, priority = 1, filename = "", lineno = 0, |
35 completed = False, _time = 0, isProjectTask = False, |
35 completed = False, _time = 0, isProjectTask = False, |
36 isBugfixTask = False, ppath = "", longtext = ""): |
36 isBugfixTask = False, project = None, longtext = ""): |
37 """ |
37 """ |
38 Constructor |
38 Constructor |
39 |
39 |
40 @param parent parent widget of the task (QWidget) |
40 @param parent parent widget of the task (QWidget) |
41 @param description descriptive text of the task (string) |
41 @param description descriptive text of the task (string) |
45 @param completed flag indicating completion status (boolean) |
45 @param completed flag indicating completion status (boolean) |
46 @param _time creation time of the task (float, if 0 use current time) |
46 @param _time creation time of the task (float, if 0 use current time) |
47 @param isProjectTask flag indicating a task related to the current project |
47 @param isProjectTask flag indicating a task related to the current project |
48 (boolean) |
48 (boolean) |
49 @param isBugfixTask flag indicating a bugfix task (boolean) |
49 @param isBugfixTask flag indicating a bugfix task (boolean) |
50 @param ppath the project path (string) |
50 @param project reference to the project object (Project) |
51 @param longtext explanatory text of the task (string) |
51 @param longtext explanatory text of the task (string) |
52 """ |
52 """ |
53 self.description = description |
53 self.description = description |
54 self.longtext = longtext |
54 self.longtext = longtext |
55 if priority in [0, 1, 2]: |
55 if priority in [0, 1, 2]: |
60 self.lineno = lineno |
60 self.lineno = lineno |
61 self.completed = completed |
61 self.completed = completed |
62 self.created = _time and _time or time.time() |
62 self.created = _time and _time or time.time() |
63 self._isProjectTask = isProjectTask |
63 self._isProjectTask = isProjectTask |
64 self.isBugfixTask = isBugfixTask |
64 self.isBugfixTask = isBugfixTask |
65 self.ppath = ppath |
65 self.project = project |
66 |
66 |
67 if isProjectTask: |
67 if isProjectTask: |
68 self.filename = self.filename.replace(self.ppath + os.sep, "") |
68 self.filename = self.project.getRelativePath(self.filename) |
69 |
69 |
70 QTreeWidgetItem.__init__(self, ["", "", self.description, self.filename, |
70 QTreeWidgetItem.__init__(self, ["", "", self.description, self.filename, |
71 (self.lineno and "%6d" % self.lineno or "")]) |
71 (self.lineno and "%6d" % self.lineno or "")]) |
72 |
72 |
73 if self.completed: |
73 if self.completed: |
529 @param isBugfixTask flag indicating a bugfix task (boolean) |
529 @param isBugfixTask flag indicating a bugfix task (boolean) |
530 @param longtext explanatory text of the task (string) |
530 @param longtext explanatory text of the task (string) |
531 """ |
531 """ |
532 task = Task(description, priority, filename, lineno, completed, |
532 task = Task(description, priority, filename, lineno, completed, |
533 _time, isProjectTask, isBugfixTask, |
533 _time, isProjectTask, isBugfixTask, |
534 self.project and self.project.ppath or "", |
534 self.project, longtext) |
535 longtext) |
|
536 self.tasks.append(task) |
535 self.tasks.append(task) |
537 if self.taskFilter.showTask(task): |
536 if self.taskFilter.showTask(task): |
538 self.addTopLevelItem(task) |
537 self.addTopLevelItem(task) |
539 self.__resort() |
538 self.__resort() |
540 self.__resizeColumns() |
539 self.__resizeColumns() |