Merge lp:~scialexlight/gtg/gtg into lp:~gtg/gtg/old-trunk

Proposed by Alex Light on 2012-04-06
Status: Rejected
Rejected by: Izidor Matušov on 2012-08-14
Proposed branch: lp:~scialexlight/gtg/gtg
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 159 lines (+53/-4)
6 files modified
AUTHORS (+1/-0)
CHANGELOG (+1/-0)
GTG/core/tag.py (+6/-1)
GTG/gtk/browser/__init__.py (+2/-0)
GTG/gtk/browser/browser.py (+34/-3)
GTG/gtk/browser/taskbrowser.glade (+9/-0)
To merge this branch: bzr merge lp:~scialexlight/gtg/gtg
Reviewer Review Type Date Requested Status
Izidor Matušov Disapprove on 2012-08-14
Bertrand Rousseau (community) 2012-04-06 Needs Information on 2012-04-21
Review via email: mp+101054@code.launchpad.net

Description of the change

This branch fixes Bug 499320 (https://bugs.launchpad.net/gtg/+bug/499320) and allows one to make a tag stay in the tag list no matter how few tasks have it. This new property is toggled using the left click context menu.

To post a comment you must log in.

Hi Alex,

Thanks a lot for your contribution!

I have some remarks regarding your branch:

 - please use the word "sticky" instead of permanent ('sticky' is a popular term for that feature, it will make the code easier to understand)

 - this is important: the way you're fixing this is only relevant if you want only a small subset of tags to be 'sticky' and still want a significant number of other empty tags to be filtered out. I already pointed this out in the related bug discussion. Is that the case? If not, then this should really be implemented as an overall tag sidebar setting: it either filters out all empty tags, or it displays all of them. It's not really more complex to implement, but it's a different way.

 - if only some tags are "sticky", then there should really be some visual clue about it (add a "pin" icon after the tag name, make all sticky tags appear in a "Sticky tags" section in the sidebar, ...). Avoid using color, it's not very effective, and it's hard to interpret.

 - some unfortunate mid-air collision happened: I just reimplemented the tag context menu programmatically, as a widget, in tag_context_menu.py. You will have to adapt your code to this. This should not be a big issue, though: in many way it is actually simpler to add menu items programmatically (look at the other items to see how it works. Basically, you add the menuitem in build_menu(), you register the callback there too, then you implement the callback at the end of the class).

Thanks again!

review: Needs Information
Izidor Matušov (izidor) wrote :

Closing due inactivity and some unsovled problems.

review: Disapprove

Unmerged revisions

1152. By Alex <alex@alex-laptop> on 2012-04-06

forgot to add messages to changelog and stuff about making tags able to be set as permanent, preventing their removal even when no tasks mention them.

1151. By Alex <alex@alex-laptop> on 2012-04-05

added ability to mark tags as permanent, so they will remain in the tag-list even if there are no more tasks with them.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2012-04-01 19:08:12 +0000
3+++ AUTHORS 2012-04-06 01:46:18 +0000
4@@ -104,3 +104,4 @@
5 * Marta Maria Casetti <mmcasetti@gmail.com>
6 * Song Yangyu <flyfy1@gmail.com>
7 * Saurabh Anand <saurabhanandiit@gmail.com>
8+* Alexander Light <scialexlight@gmail.com>
9
10=== modified file 'CHANGELOG'
11--- CHANGELOG 2012-04-02 18:06:56 +0000
12+++ CHANGELOG 2012-04-06 01:46:18 +0000
13@@ -13,6 +13,7 @@
14 * added start: which has the same meaning as defer:
15 * Automatic restore a backup XML file if the original XML file could not be loaded
16 * Backends were renamed to Synchronization Services, by Anant Gupta
17+ * Can set tags as permanent, making them stay in the list even if they are not mentioned in any events.
18
19 2012-02-13 Getting Things GNOME! 0.2.9
20 * Big refractorization of code, now using liblarch
21
22=== modified file 'GTG/core/tag.py'
23--- GTG/core/tag.py 2012-03-21 21:46:47 +0000
24+++ GTG/core/tag.py 2012-04-06 01:46:18 +0000
25@@ -174,6 +174,11 @@
26 def is_removable(self):
27 attr = self.get_all_attributes(butname=True, withparent=True)
28 return (len(attr) <= 0 and not self.is_used())
29+
30+ # This tag has been set as permanent by the user, it will
31+ # be displayed even if no tasks currently have it.
32+ def is_permanent(self):
33+ return bool(self.get_attribute('is_permanent'))
34
35 def is_special(self):
36 return bool(self.get_attribute('special'))
37@@ -185,7 +190,7 @@
38 return self.get_total_tasks_count() > 0
39
40 def is_actively_used(self):
41- return self.is_search_tag() or self.is_special() or self.get_active_tasks_count() > 0
42+ return self.is_search_tag() or self.is_special() or self.is_permanent() or self.get_active_tasks_count() > 0
43
44 def __str__(self):
45 return "Tag: %s" % self.get_name()
46
47=== modified file 'GTG/gtk/browser/__init__.py'
48--- GTG/gtk/browser/__init__.py 2012-03-27 10:46:47 +0000
49+++ GTG/gtk/browser/__init__.py 2012-04-06 01:46:18 +0000
50@@ -49,3 +49,5 @@
51 TAG_NOTIN_WORKVIEW_TOGG = _("Show this tag in the workview")
52 QUICKADD_ENTRY_TOOLTIP = _("You can create, open or filter your tasks here")
53 QUICKADD_ICON_TOOLTIP = _("Clear")
54+ MAKE_TAG_PERMANENT = _("Make Tag Permanent")
55+ MAKE_TAG_NOT_PERMANENT = _("Make Tag Not Permanent")
56
57=== modified file 'GTG/gtk/browser/browser.py'
58--- GTG/gtk/browser/browser.py 2012-04-03 06:01:15 +0000
59+++ GTG/gtk/browser/browser.py 2012-04-06 01:46:18 +0000
60@@ -128,7 +128,7 @@
61
62 self.on_select_tag()
63 self.browser_shown = False
64-
65+
66 #Update the title when a task change
67 self.activetree.register_cllbck('node-added-inview', self._update_window_title)
68 self.activetree.register_cllbck('node-deleted-inview', self._update_window_title)
69@@ -154,6 +154,7 @@
70 self.searchpopup = self.builder.get_object("search_context_menu")
71 self.nonworkviewtag_cb = self.builder.get_object("nonworkviewtag_mi")
72 self.nonworkviewtag_cb.set_label(GnomeConfig.TAG_IN_WORKVIEW_TOGG)
73+ self.permanent_tag_cb = self.builder.get_object("permanent_tag_mi")
74 self.taskpopup = self.builder.get_object("task_context_menu")
75 self.defertopopup = self.builder.get_object("defer_to_context_menu")
76 self.ctaskpopup = self.builder.get_object("closed_task_context_menu")
77@@ -338,6 +339,8 @@
78 lambda w: openurl(info.REPORT_BUG_URL),
79 "on_nonworkviewtag_toggled":
80 self.on_nonworkviewtag_toggled,
81+ "on_permanent_tag_mi_toggled":
82+ self.on_permanent_tag_mi_toggled,
83 "on_preferences_activate":
84 self.open_preferences,
85 "on_edit_backends_activate":
86@@ -703,7 +706,7 @@
87 t = self.req.get_tag(tname)
88 t.del_attribute("color")
89 self.reset_cursor()
90-
91+
92 def on_tagcontext_deactivate(self, menushell):
93 self.reset_cursor()
94
95@@ -899,8 +902,15 @@
96 # the special 'All tags' or 'Tasks without tags'. We only
97 # want to popup the menu for normal tags.
98
99- display_in_workview_item = self.tagpopup.get_children()[2]
100+ display_in_workview_item = self.tagpopup.get_children()[3]
101 selected_tag = self.req.get_tag(selected_tags[0])
102+ # Make sure that the permanent option is correct.
103+ if selected_tag.is_permanent():
104+ label = GnomeConfig.MAKE_TAG_NOT_PERMANENT
105+ else:
106+ label = GnomeConfig.MAKE_TAG_PERMANENT
107+ self.permanent_tag_cb.set_label(label)
108+
109 nonworkview = selected_tag.get_attribute("nonworkview")
110 # We must invert because the tagstore has "True" for tasks
111 # that are *not* in workview, and the checkbox is set if
112@@ -938,6 +948,27 @@
113 self.nonworkviewtag_cb.set_label(label)
114 if not self.dont_reset:
115 self.reset_cursor()
116+
117+ def on_permanent_tag_mi_toggled(self, widget):
118+ """
119+ Toggles a tags permanence, and removes a tag if it is
120+ no longer active and its permanence is turned off.
121+ """
122+ self.set_target_cursor()
123+ tag_id = self.get_selected_tags()[0]
124+ tag = self.req.get_tag(tag_id)
125+ toset = not tag.is_permanent()
126+ if toset:
127+ tag.set_attribute('is_permanent','True')
128+ label = GnomeConfig.MAKE_TAG_NOT_PERMANENT
129+ else:
130+ tag.del_attribute('is_permanent')
131+ label = GnomeConfig.MAKE_TAG_PERMANENT
132+ # The tag might no longer need to be there so better check.
133+ self.tagtree.refresh_all()
134+ self.permanent_tag_cb.set_label(label)
135+ if not self.dont_reset:
136+ self.reset_cursor()
137
138 def on_task_treeview_button_press_event(self, treeview, event):
139 """Pop up context menu on right mouse click in the main task tree view"""
140
141=== modified file 'GTG/gtk/browser/taskbrowser.glade'
142--- GTG/gtk/browser/taskbrowser.glade 2012-04-02 18:06:56 +0000
143+++ GTG/gtk/browser/taskbrowser.glade 2012-04-06 01:46:18 +0000
144@@ -1170,6 +1170,15 @@
145 </object>
146 </child>
147 <child>
148+ <object class="GtkImageMenuItem" id="permanent_tag_mi">
149+ <property name="visible">True</property>
150+ <property name="can_focus">False</property>
151+ <property name="use_action_appearance">False</property>
152+ <property name="use_underline">True</property>
153+ <signal name="activate" handler="on_permanent_tag_mi_toggled" swapped="no"/>
154+ </object>
155+ </child>
156+ <child>
157 <object class="GtkCheckMenuItem" id="nonworkviewtag_mi">
158 <property name="visible">True</property>
159 <property name="can_focus">False</property>

Subscribers

People subscribed via source and target branches

to status/vote changes: