Merge lp:~fraser-waters08/spud/subtree-expand-collapse into lp:spud

Proposed by Fraser Waters
Status: Merged
Approved by: Patrick Farrell
Approved revision: 401
Merged at revision: 402
Proposed branch: lp:~fraser-waters08/spud/subtree-expand-collapse
Merge into: lp:spud
Diff against target: 32 lines (+15/-0)
1 file modified
diamond/diamond/interface.py (+15/-0)
To merge this branch: bzr merge lp:~fraser-waters08/spud/subtree-expand-collapse
Reviewer Review Type Date Requested Status
Patrick Farrell Pending
Review via email: mp+66795@code.launchpad.net

Description of the change

Pressing the left or right arrow keys while a row in the LHS treeview is selected and has focus will collapse or expand that subtree node.

To post a comment you must log in.
Revision history for this message
Patrick Farrell (pefarrell) wrote :

That works beautifully.

Expanding on the idea of the original bug report: maybe can you add more keyboard interaction
functionality? Use your common sense, but I am thinking it would be handy if

Enter -- activate inactive option / add a new instance of a zero-or-more/one-or-more
Delete -- deactivate active option / delete instance of ^^^^^^^^^^^^^^^^^^^^^^^^

Can you think of any more?

That being said, I'm very happy for this to be merged as-is; it fixes the existing bug report

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'diamond/diamond/interface.py'
--- diamond/diamond/interface.py 2011-07-04 09:57:05 +0000
+++ diamond/diamond/interface.py 2011-07-04 14:02:31 +0000
@@ -667,6 +667,7 @@
667667
668 self.treeview = optionsTree = self.gui.get_widget("optionsTree")668 self.treeview = optionsTree = self.gui.get_widget("optionsTree")
669 self.treeview.connect("row-collapsed", self.on_treeview_row_collapsed)669 self.treeview.connect("row-collapsed", self.on_treeview_row_collapsed)
670 self.treeview.connect("key_press_event", self.on_treeview_key_press)
670 try: # allow for possibility of no tooltips (like elsewhere)671 try: # allow for possibility of no tooltips (like elsewhere)
671 self.treeview.connect("query-tooltip", self.on_tooltip)672 self.treeview.connect("query-tooltip", self.on_tooltip)
672 self.treeview.set_property("has-tooltip", False)673 self.treeview.set_property("has-tooltip", False)
@@ -1168,6 +1169,20 @@
11681169
1169 return True1170 return True
11701171
1172 def on_treeview_key_press(self, treeview, event):
1173 """
1174 Called when treeview intercepts a key press. Collapse and expand rows.
1175 """
1176
1177 if event.keyval == gtk.keysyms.Right:
1178 self.treeview.expand_row(self.get_selected_row(), open_all = False)
1179
1180 if event.keyval == gtk.keysyms.Left:
1181 self.treeview.collapse_row(self.get_selected_row())
1182
1183 return
1184
1185
1171 def on_select_row(self, selection=None):1186 def on_select_row(self, selection=None):
1172 """1187 """
1173 Called when a row is selected. Update the options frame.1188 Called when a row is selected. Update the options frame.

Subscribers

People subscribed via source and target branches