gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03509
[Merge] lp:~bertrand-rousseau/gtg/bug-988235 into lp:gtg
Bertrand Rousseau has proposed merging lp:~bertrand-rousseau/gtg/bug-988235 into lp:gtg.
Requested reviews:
Gtg developers (gtg)
Related bugs:
Bug #988235 in Getting Things GNOME!: "Changing tag color doesn't refresh task list"
https://bugs.launchpad.net/gtg/+bug/988235
For more details, see:
https://code.launchpad.net/~bertrand-rousseau/gtg/bug-988235/+merge/104853
This branch fixes bug 988235 (task & tag refresh in the browser). This is coupled to another commit in liblarch: https://github.com/liblarch/liblarch/pull/3 (get_nodes() function is required to make this work)
To test it you will need to checkout my liblarch branch on github: https://github.com/broussea/liblarch
--
https://code.launchpad.net/~bertrand-rousseau/gtg/bug-988235/+merge/104853
Your team Gtg developers is requested to review the proposed merge of lp:~bertrand-rousseau/gtg/bug-988235 into lp:gtg.
=== modified file 'GTG/core/tag.py'
--- GTG/core/tag.py 2012-04-22 11:56:25 +0000
+++ GTG/core/tag.py 2012-05-05 23:33:19 +0000
@@ -81,16 +81,26 @@
@param att_value: The value of the attribute. Will be converted to a
string.
"""
+ modified = False
if att_name == "name":
raise Exception("The name of tag cannot be set manually")
elif att_name == "parent":
self.add_parent(att_value)
+ modified = True
else:
# Attributes should all be strings.
val = unicode(str(att_value), "UTF-8")
self._attributes[att_name] = val
if self._save:
self._save()
+ modified = True
+ if modified:
+ self.modified()
+ # notify all related tasks tools
+ for task_id in self.get_related_tasks():
+ my_task = self.req.get_task(task_id)
+ assert my_task is not None, "Unknown task id: %s" % task_id
+ my_task.modified()
def get_attribute(self, att_name):
"""Get the attribute C{att_name}.
@@ -147,20 +157,23 @@
return self.__get_count()
def __get_count(self, tasktree=None):
+ return len(self.get_related_tasks(tasktree=tasktree))
+
+ def get_related_tasks(self, tasktree=None):
if not tasktree:
tasktree = self.req.get_tasks_tree()
sp_id = self.get_attribute("special")
if sp_id == "all":
- toreturn = tasktree.get_n_nodes(\
+ toreturn = tasktree.get_nodes(\
withfilters=['active'], include_transparent=False)
elif sp_id == "notag":
- toreturn = tasktree.get_n_nodes(\
+ toreturn = tasktree.get_nodes(\
withfilters=['notag'], include_transparent=False)
elif sp_id == "sep" :
- toreturn = 0
+ toreturn = []
else:
tname = self.get_name()
- toreturn = tasktree.get_n_nodes(\
+ toreturn = tasktree.get_nodes(\
withfilters=[tname], include_transparent=False)
return toreturn