Added Qct-style keyboard accelerators for the status module. Ctrl-, Ctrl-. select the previous/next file in the status pane. Ctrl-[] scrolls the current diff notebook page up/down a page. The accelerators work wherever the status widget is used, for example the commit and repository explorer dialogs.
# HG changeset patch # User Daniel Rocco <dro...@westga.edu> # Date 1262546850 18000 # Node ID ff54a2ee9bc30a54c4232f9d8dc8f4fb60209333 # Parent f53deaba6f9cd3d2e9e8bbf01d513b3ba6697228 status: add accelerators for next/previous file, scroll up/down diff Added Qct-style keyboard accelerators for the status module. Ctrl-, Ctrl-. select the previous/next file in the status pane. Ctrl-[] scrolls the current diff notebook page up/down a page. The accelerators work wherever the status widget is used, for example the commit and repository explorer dialogs. diff -r f53deaba6f9c -r ff54a2ee9bc3 tortoisehg/hgtk/hgtk.py --- a/tortoisehg/hgtk/hgtk.py Sat Jan 02 12:13:05 2010 -0600 +++ b/tortoisehg/hgtk/hgtk.py Sun Jan 03 14:27:30 2010 -0500 @@ -39,7 +39,9 @@ 'mq-move-bottom', 'mq-pop', 'mq-push'): gobject.signal_new(sig, gtk.TreeView, gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ()) -for sig in ('thg-exit', 'thg-close', 'thg-refresh', 'thg-accept', 'thg-reflow'): +for sig in ('thg-exit', 'thg-close', 'thg-refresh', 'thg-accept', + 'thg-reflow', 'status-scroll-down', 'status-scroll-up', + 'status-next-file', 'status-previous-file'): gobject.signal_new(sig, gtk.Window, gobject.SIGNAL_ACTION, gobject.TYPE_NONE, ()) for sig in ('thg-close', 'thg-new'): diff -r f53deaba6f9c -r ff54a2ee9bc3 tortoisehg/hgtk/status.py --- a/tortoisehg/hgtk/status.py Sat Jan 02 12:13:05 2010 -0600 +++ b/tortoisehg/hgtk/status.py Sun Jan 03 14:27:30 2010 -0500 @@ -349,6 +349,43 @@ modifier, gtk.ACCEL_VISIBLE) difftree.connect('copy-clipboard', self.copy_to_clipboard) + def scroll_diff_notebook(widget, direction=gtk.SCROLL_PAGE_DOWN): + page_num = self.diff_notebook.get_current_page() + page = self.diff_notebook.get_nth_page(page_num) + + page.emit("scroll-child", direction, False) + + def move_filetree_selection(widget, distance=1): + row = 0 + path = self.filetree.get_cursor()[0] + if path: + row = path[0] + model = self.filetree.get_model() + + # make sure new row is within bounds + new_row = min((row + distance), len(model) - 1) + new_row = max(0, new_row) + + selected = model.get_iter_from_string(str(new_row)) + selection = self.filetree.get_selection() + selection.unselect_all() + selection.select_iter(selected) + self.filetree.set_cursor(model.get_path(selected)) + + status_accelerators = [ + ('status-scroll-down', 'bracketright', scroll_diff_notebook, + gtk.SCROLL_PAGE_DOWN), + ('status-scroll-up', 'bracketleft', scroll_diff_notebook, + gtk.SCROLL_PAGE_UP), + ('status-next-file', 'period', move_filetree_selection, 1), + ('status-previous-file', 'comma', move_filetree_selection, -1), + ] + + for signal, accelerator, handler, param in status_accelerators: + key, modifier = gtk.accelerator_parse(mod + accelerator) + self.add_accelerator(signal, accelgroup, key, modifier, 0) + self.connect(signal, handler, param) + difftree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) difftree.set_headers_visible(False) difftree.set_enable_search(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