Tasks/TaskViewer.py

changeset 248
f4561c24989a
parent 97
c4086afea02b
child 428
58405c24aa09
child 792
a13346916170
--- a/Tasks/TaskViewer.py	Fri May 14 17:23:52 2010 +0200
+++ b/Tasks/TaskViewer.py	Fri May 14 17:26:38 2010 +0200
@@ -33,7 +33,7 @@
     """
     def __init__(self, description, priority = 1, filename = "", lineno = 0, 
                  completed = False, _time = 0, isProjectTask = False, 
-                 isBugfixTask = False, ppath = "", longtext = ""):
+                 isBugfixTask = False, project = None, longtext = ""):
         """
         Constructor
         
@@ -47,7 +47,7 @@
         @param isProjectTask flag indicating a task related to the current project
             (boolean)
         @param isBugfixTask flag indicating a bugfix task (boolean)
-        @param ppath the project path (string)
+        @param project reference to the project object (Project)
         @param longtext explanatory text of the task (string)
         """
         self.description = description
@@ -62,10 +62,10 @@
         self.created = _time and _time or time.time()
         self._isProjectTask = isProjectTask
         self.isBugfixTask = isBugfixTask
-        self.ppath = ppath
+        self.project = project
         
         if isProjectTask:
-            self.filename = self.filename.replace(self.ppath + os.sep, "")
+            self.filename = self.project.getRelativePath(self.filename)
             
         QTreeWidgetItem.__init__(self, ["", "", self.description, self.filename, 
             (self.lineno and "%6d" % self.lineno or "")])
@@ -165,7 +165,7 @@
         @return filename (string)
         """
         if self._isProjectTask and self.filename:
-            return os.path.join(self.ppath, self.filename)
+            return os.path.join(self.project.getProjectPath(), self.filename)
         else:
             return self.filename
     
@@ -531,8 +531,7 @@
         """
         task = Task(description, priority, filename, lineno, completed, 
                    _time, isProjectTask, isBugfixTask, 
-                   self.project and self.project.ppath or "", 
-                   longtext)
+                   self.project, longtext)
         self.tasks.append(task)
         if self.taskFilter.showTask(task):
             self.addTopLevelItem(task)

eric ide

mercurial