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.title = _("My new task")
        # available status are: Active - Done - Dismiss - Note
        self.status = self.STA_ACTIVE
        self.closed_date = Date.no_date()
        self.due_date = Date.no_date()
        self.start_date = 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, 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, str))
        self.tid = str(ze_id)
        self.set_uuid(uuid.uuid4())
        self.remote_ids = {}
        self.content = ""
        self.title = _("My new task")
        # available status are: Active - Done - Dismiss - Note
        self.status = self.STA_ACTIVE
        self.closed_date = Date.no_date()
        self.due_date = Date.no_date()
        self.start_date = 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.º 3
0
 def set_parent(self, parent_id):
     """Update the task's parent. Refresh due date constraints."""
     TreeNode.set_parent(self, parent_id)
     if parent_id is not None:
         par = self.req.get_task(parent_id)
         par_duedate = par.get_due_date_constraint()
         if not par_duedate.is_fuzzy() and \
             not self.due_date.is_fuzzy() and \
                 par_duedate < self.due_date:
             self.set_due_date(par_duedate)
     self.recursive_sync()
Exemplo n.º 4
0
Arquivo: task.py Projeto: snoord/gtg
 def set_parent(self, parent_id):
     """Update the task's parent. Refresh due date constraints."""
     TreeNode.set_parent(self, parent_id)
     if parent_id is not None:
         par = self.req.get_task(parent_id)
         par_duedate = par.get_due_date_constraint()
         if not par_duedate.is_fuzzy() and \
             not self.due_date.is_fuzzy() and \
                 par_duedate < self.due_date:
             self.set_due_date(par_duedate)
     self.recursive_sync()
Exemplo n.º 5
0
    def __init__(self, name, req, attributes={}):
        """Construct a tag.

        @param name: The name of the tag. Should be a string, generally
            a short one.
        @param attributes: Allow having initial set of attributes without
            calling _save callback
        """
        TreeNode.__init__(self, name)
        self._name = saxutils.unescape(str(name))
        self.req = req
        self._save = None
        self._attributes = {'name': self._name}
        for key, value in attributes.iteritems():
            self.set_attribute(key, value)

        self.viewcount = None
Exemplo n.º 6
0
    def __init__(self, name, req, attributes={}):
        """Construct a tag.

        @param name: The name of the tag. Should be a string, generally
            a short one.
        @param attributes: Allow having initial set of attributes without
            calling _save callback
        """
        TreeNode.__init__(self, name)
        self._name = saxutils.unescape(str(name))
        self.req = req
        self._save = None
        self._attributes = {'name': self._name}
        for key, value in attributes.iteritems():
            self.set_attribute(key, value)

        self.viewcount = None
Exemplo n.º 7
0
    def set_parent(self, parent_id):
        """Update the task's parent. Refresh due date constraints."""
        TreeNode.set_parent(self, parent_id)
        if parent_id is not None:
            par = self.req.get_task(parent_id)

            # Adopt the stricter deadline...
            par_duedate = par.get_due_date_constraint()
            if par_duedate < self.due_date:
                self.set_due_date(par_duedate)

            # Accumulate more tags...
            for tag in par.get_tag_names():
                self.add_tag(tag)

        self._has_been_modified()
        self.recursive_sync()
Exemplo n.º 8
0
Arquivo: task.py Projeto: snoord/gtg
    def add_child(self, tid):
        """Add a subtask to this task

        @param child: the added task
        """
        log.debug(f"adding child {tid} to task {self.get_id()}")
        self.can_be_deleted = False
        # the core of the method is in the TreeNode object
        TreeNode.add_child(self, tid)
        # now we set inherited attributes only if it's a new task
        child = self.req.get_task(tid)
        if self.is_loaded() and child and child.can_be_deleted:
            child.set_start_date(self.get_start_date())
            child.set_due_date(self.get_due_date())
            for t in self.get_tags():
                child.add_tag(t.get_name())
        self.sync()
        return True
Exemplo n.º 9
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
        TreeNode.add_child(self, tid)
        # now we set inherited attributes only if it's a new task
        child = self.req.get_task(tid)
        if self.is_loaded() and child and child.can_be_deleted:
            child.set_start_date(self.get_start_date())
            child.set_due_date(self.get_due_date())
            for t in self.get_tags():
                child.add_tag(t.get_name())
        self.sync()
        return True
Exemplo n.º 10
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
        TreeNode.add_child(self, tid)
        # now we set inherited attributes only if it's a new task
        child = self.req.get_task(tid)
        if self.is_loaded() and child and child.can_be_deleted:
            # If the the child is repeating no need to change the date
            if not child.get_recurring():
                child.set_start_date(self.get_start_date())
                child.set_due_date(self.get_due_date())
            for t in self.get_tags():
                child.add_tag(t.get_name())

            child.inherit_recursion()

        self.sync()
        return True
Exemplo n.º 11
0
Arquivo: tag.py Projeto: jaesivsm/gtg
 def add_parent(self, parent_id):
     p = self.req.get_tag(parent_id)
     if p and not self.is_special() and not p.is_special():
         TreeNode.add_parent(self, parent_id)
Exemplo n.º 12
0
 def __init__(self,node_id):
     self.status = "online"
     self.nick = ""
     TreeNode.__init__(self,node_id)
     #A contact cannot have children node. We disable that
     self.set_children_enabled(False)
Exemplo n.º 13
0
 def add_child(self, child_id):
     special_child = self.req.get_tag(child_id).is_special()
     if not self.is_special() and not special_child:
         TreeNode.add_child(self, child_id)
Exemplo n.º 14
0
 def add_parent(self, parent_id):
     p = self.req.get_tag(parent_id)
     if p and not self.is_special() and not p.is_special():
         TreeNode.add_parent(self, parent_id)
Exemplo n.º 15
0
 def __init__(self, tid, label,viewtree):
     TreeNode.__init__(self, tid)
     self.label = label
     self.tid = tid
     self.vt = viewtree
Exemplo n.º 16
0
 def __init__(self, tid, label,viewtree):
     TreeNode.__init__(self, tid)
     self.label = label
     self.tid = tid
     self.vt = viewtree
Exemplo n.º 17
0
 def __init__(self, node_id):
     TreeNode.__init__(self, node_id)
     # A team cannot have parents. This is arbitrarly done for the purpose
     # of this example.
     self.set_parents_enabled(False)
Exemplo n.º 18
0
 def __init__(self, node_id):
     self.status = "online"
     self.nick = ""
     TreeNode.__init__(self, node_id)
     # A contact cannot have children node. We disable that
     self.set_children_enabled(False)
Exemplo n.º 19
0
 def __init__(self,node_id):
     TreeNode.__init__(self,node_id)
     #A team cannot have parents. This is arbitrarly done for the purpose
     #of this example.
     self.set_parents_enabled(False)
Exemplo n.º 20
0
Arquivo: tag.py Projeto: jaesivsm/gtg
 def add_child(self, child_id):
     special_child = self.req.get_tag(child_id).is_special()
     if not self.is_special() and not special_child:
         TreeNode.add_child(self, child_id)
Exemplo n.º 21
0
 def __init__(self,tid):
     TreeNode.__init__(self, tid)
     self.colors = []