[sugar] [PATCH] scroll activity list with the arrow keys

Tomeu Vizoso tomeu at tomeuvizoso.net
Thu May 15 06:38:49 EDT 2008


Hi,

the patch below adds the Up and Down arrow keys to the
gtk.ScrolledWindow key bindings in the activity list as requested by
Eben.

But, if I understand correctly, this code alters the behavior of _all_
the gtk.ScrolledWindow instances in the shell. Two questions:

- To Eben: Is this desired?

- To anyone: Which place would be best for this code?

Thanks,

Tomeu

diff --git a/src/view/home/activitieslist.py b/src/view/home/activitieslist.py
index f638738..7264852 100644
--- a/src/view/home/activitieslist.py
+++ b/src/view/home/activitieslist.py
@@ -15,6 +15,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

 import gobject
+import gtk
 import hippo

 from sugar import profile
@@ -31,7 +32,17 @@ class ActivitiesList(hippo.CanvasScrollbars):
     def __init__(self):
         hippo.CanvasScrollbars.__init__(self)
         self.set_policy(hippo.ORIENTATION_HORIZONTAL, hippo.SCROLLBAR_NEVER)
-
+
+        gtk.binding_entry_add_signal(gtk.ScrolledWindow, gtk.keysyms.Up, 0,
+                                     'scroll-child',
+                                     gtk.ScrollType, gtk.SCROLL_STEP_BACKWARD,
+                                     bool, False)
+
+        gtk.binding_entry_add_signal(gtk.ScrolledWindow, gtk.keysyms.Down, 0,
+                                     'scroll-child',
+                                     gtk.ScrollType, gtk.SCROLL_STEP_FORWARD,
+                                     bool, False)
+
         self._box = hippo.CanvasBox( \
                 background_color=style.COLOR_WHITE.get_int())
         self.set_root(self._box)


More information about the Sugar mailing list