GTG

Merge lp:~jml/gtg/fix-tag-context-menu-bug-398667 into lp:~gtg/gtg/old-trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jml/gtg/fix-tag-context-menu-bug-398667
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: None lines
To merge this branch: bzr merge lp:~jml/gtg/fix-tag-context-menu-bug-398667
Reviewer Review Type Date Requested Status
Gtg developers Pending
Review via email: mp+8670@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote :

This patch simplifies the code for the tag context menu, incidentally making it actually work on my system.

I'm unclear as to what the underlying bug is, but getting rid of the show() / hide() stuff fixes it.

265. By Jonathan Lange

Simply don't popup the menu for the special tags.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/taskbrowser/browser.py'
2--- GTG/taskbrowser/browser.py 2009-07-12 08:05:05 +0000
3+++ GTG/taskbrowser/browser.py 2009-07-13 06:44:43 +0000
4@@ -1146,8 +1146,8 @@
5 #When an editor is closed, it should deregister itself
6 def close_task(self,tid) :
7 if self.opened_task.has_key(tid) :
8- del self.opened_task[tid]
9-
10+ del self.opened_task[tid]
11+
12 def on_tag_treeview_button_press_event(self,treeview,event) :
13 if event.button == 3:
14 x = int(event.x)
15@@ -1157,24 +1157,22 @@
16 if pthinfo is not None:
17 path, col, cellx, celly = pthinfo #pylint: disable-msg=W0612
18 treeview.grab_focus()
19- treeview.set_cursor( path, col, 0)
20- self.tagpopup.popup( None, None, None, event.button, time)
21- tags = self.get_selected_tags()[0]
22- nonworkview_item = self.tagpopup.get_children()[1]
23- nonworkview_item.hide()
24- if len(tags) > 0 :
25- tag = tags[0]
26- attri = tag.get_attribute("nonworkview")
27- #We must inverse because the tagstore has True
28- #for tasks that are not in workview
29- if attri == "True" : toset = False
30- else : toset = True
31- nonworkview_item.set_active(toset)
32- nonworkview_item.show()
33- else :
34- nonworkview_item.hide()
35+ treeview.set_cursor(path, col, 0)
36+ self.tagpopup.popup(None, None, None, event.button, time)
37+ # There will always be exactly one selected tag.
38+ selected_tag = self.get_selected_tags()[0][0]
39+ display_in_workview_item = self.tagpopup.get_children()[1]
40+ nonworkview = selected_tag.get_attribute("nonworkview")
41+ # We must invert because the tagstore has "True" for tasks
42+ # that are *not* in workview, and the checkbox is set if the
43+ # tag *is* shown in the workview.
44+ if nonworkview == "True":
45+ shown = False
46+ else:
47+ shown = True
48+ display_in_workview_item.set_active(shown)
49 return 1
50-
51+
52 def on_nonworkviewtag_toggled(self,widget) : #pylint: disable-msg=W0613
53 tags = self.get_selected_tags()[0]
54 nonworkview_item = self.tagpopup.get_children()[1]

Subscribers

People subscribed via source and target branches

to status/vote changes: