Exemplo n.º 1
0
    def __init__(self, ze_id, requester, newtask=False):
        TreeNode.__init__(self, ze_id)
        #the id of this task in the project should be set
        #tid is a string ! (we have to choose a type and stick to it)
        assert(isinstance(ze_id, str) or isinstance(ze_id, unicode))
        self.tid = str(ze_id)
        self.set_uuid(uuid.uuid4())
        self.remote_ids = {}
        self.content = ""
        #self.content = \
        #    "<content>Press Escape or close this task to save it</content>"
        self.title = _("My new task")
        #available status are: Active - Done - Dismiss - Note
        self.status = self.STA_ACTIVE
        self.closed_date = no_date
        self.due_date = no_date
        self.start_date = no_date
        self.can_be_deleted = newtask
        # tags
        self.tags = []
        self.req = requester
        self.__main_treeview = requester.get_main_view()
        #If we don't have a newtask, we will have to load it.
        self.loaded = newtask
        #Should not be necessary with the new backends
#        if self.loaded:
#            self.req._task_loaded(self.tid)
        self.attributes={}
        self._modified_update()
Exemplo n.º 2
0
    def __init__(self, name, req):
        """Construct a tag.

        @param name: The name of the tag. Should be a string, generally a
            short one.
        """
        TreeNode.__init__(self, name)
        self._name = saxutils.unescape(str(name))
        self.req = req
        self._attributes = {'name': self._name}
        self._save = None
        self._tasks_count = 0
Exemplo n.º 3
0
 def has_parents(self, tag=None):
     has_par = TreeNode.has_parent(self)
     #The "all tag" argument
     if tag and has_par:
         a = 0
         for tid in self.get_parents():
             p = self.req.get_task(tid)
             a += p.has_tags(tag)
         to_return = a
     else:
         to_return = has_par
     return to_return
Exemplo n.º 4
0
    def remove_child(self,tid):
        """Removed a subtask from the task.

        @param tid: the ID of the task to remove
        """
        if TreeNode.remove_child(self,tid):
            task = self.req.get_task(tid)
            if task.can_be_deleted:
                #child is a new, unmodified task
                # It should be deleted
                self.req.delete_task(tid)
            self.sync()
            return True
        else:
            return False
Exemplo n.º 5
0
    def add_child(self, tid):
        """Add a subtask to this task

        @param child: the added task
        """
        Log.debug("adding child %s to task %s" %(tid, self.get_id()))
        self.can_be_deleted = False
        #the core of the method is in the TreeNode object
        if TreeNode.add_child(self,tid):
            #now we set inherited attributes only if it's a new task
            child = self.req.get_task(tid)
            if child.can_be_deleted:
                child.set_start_date(self.get_start_date())
                for t in self.get_tags():
                    child.tag_added(t.get_name())
            self.sync()
            return True
        else:
            Log.debug("child addition failed (or still pending)")
            return False
 def __init__(self,tid):
     TreeNode.__init__(self, tid)
     self.colors = []