# HG changeset patch # User Daniel Rocco <dro...@westga.edu> # Date 1263006653 18000 # Node ID a8ffab384c40d00d041e7129e02f25a70743249c # Parent da21de5c3a411cf364917aec568a2cf6cdace499 status: preserve selection state on right-click in filetree
If the user right-clicks the filetree on a currently-selected item, preserve any existing selection. Otherwise, set the selection to the clicked item. See http://www.daa.com.au/pipermail/pygtk/2005-June/010465.html closes #633 diff -r da21de5c3a41 -r a8ffab384c40 tortoisehg/hgtk/status.py --- a/tortoisehg/hgtk/status.py Sat Jan 09 01:51:12 2010 +0900 +++ b/tortoisehg/hgtk/status.py Fri Jan 08 22:10:53 2010 -0500 @@ -275,6 +275,7 @@ self.filetree = gtk.TreeView(self.filemodel) self.filetree.connect('popup-menu', self.tree_popup_menu) + self.filetree.connect('button-press-event', self.tree_button_press) self.filetree.connect('button-release-event', self.tree_button_release) self.filetree.connect('row-activated', self.tree_row_act) self.filetree.connect('key-press-event', self.tree_key_press) @@ -1464,6 +1465,31 @@ self.update_chunk_state(entry) self.update_check_count() + def tree_button_press(self, treeview, event): + '''Selection management for filetree right-click + + If the user right-clicks on a currently-selected item in the + filetree, preserve their entire existing selection for the popup menu. + + http://www.daa.com.au/pipermail/pygtk/2005-June/010465.html + ''' + if event.button != 3: + return False + + clicked_row = treeview.get_path_at_pos(int(event.x), + int(event.y)) + + selection = treeview.get_selection() + selected_rows = selection.get_selected_rows()[1] + + # If they didn't right-click on a currently selected row, + # change the selection + if clicked_row[0] not in selected_rows: + selection.unselect_all() + selection.select_path(clicked_row[0]) + + return True + def tree_button_release(self, treeview, event): if event.button != 3: return False
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop