Added accelerators Ctrl-., to select the next/previous file in the filetree and
Ctrl-[] to scroll the diff display.


# HG changeset patch
# User Daniel Rocco <dro...@westga.edu>
# Date 1262664132 18000
# Node ID 2c6b1bd2d59f1ab2215fd2bedbc04a4185197c42
# Parent  241defa8cb8a560980194a81fbdf6c2df2346c7f
changeset: accelerators to move file selection, scroll diff display

Added accelerators Ctrl-., to select the next/previous file in the filetree and
Ctrl-[] to scroll the diff display.

diff -r 241defa8cb8a -r 2c6b1bd2d59f tortoisehg/hgtk/changeset.py
--- a/tortoisehg/hgtk/changeset.py	Mon Jan 04 22:13:43 2010 -0500
+++ b/tortoisehg/hgtk/changeset.py	Mon Jan 04 23:02:12 2010 -0500
@@ -179,8 +179,10 @@
         self.curnodes = (parent, ctx.node())
         if selrow is not None:
             self._filesel.select_path((selrow,))
+            self._filelist_tree.set_cursor((selrow,))
         elif len(self._filelist) > 1:
             self._filesel.select_path((1,))
+            self._filelist_tree.set_cursor((1,))
         else:
             self._filesel.select_path((0,))
 
@@ -669,6 +671,7 @@
         filelist_tree.connect('row-activated', self.file_row_act)
         filelist_tree.set_search_equal_func(self.search_filelist)
         filelist_tree.modify_font(pango.FontDescription(self.fontlist))
+        self._filelist_tree = filelist_tree
 
         accelgroup = gtk.AccelGroup()
         if self.glog_parent:
@@ -681,6 +684,27 @@
                         modifier, gtk.ACCEL_VISIBLE)
         filelist_tree.connect('thg-diff', self.thgdiff)
 
+        def scroll_details(widget, direction=gtk.SCROLL_PAGE_DOWN):
+            self.diffscroller.emit("scroll-child", direction, False)
+
+        # signal, accelerator key, handler, (parameters,)
+        status_accelerators = [
+            ('status-scroll-down', 'bracketright', scroll_details,
+             (gtk.SCROLL_PAGE_DOWN,)),
+            ('status-scroll-up', 'bracketleft', scroll_details,
+             (gtk.SCROLL_PAGE_UP,)),
+            ('status-next-file', 'period', gtklib.move_treeview_selection,
+             (filelist_tree, 1)),
+            ('status-previous-file', 'comma', gtklib.move_treeview_selection,
+             (filelist_tree, -1)),
+        ]
+        
+        for signal, accelerator, handler, param in status_accelerators:
+            root = self.glog_parent or self
+            gtklib.add_accelerator(root, signal, accelgroup,
+                                   mod + accelerator)
+            root.connect(signal, handler, *param)
+
         self._filelist = gtk.ListStore(
                 gobject.TYPE_STRING,   # MAR status
                 gobject.TYPE_STRING,   # filename (utf-8 encoded)
------------------------------------------------------------------------------
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

Reply via email to