[Sugar-devel] [PATCH Browse] Step scroll with the keypad arrow keys OLPC #11806

Manuel Quiñones manuq at laptop.org
Sat Apr 28 19:06:45 EDT 2012


Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
 webactivity.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/webactivity.py b/webactivity.py
index 156ea3c..2e93ae6 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -464,6 +464,23 @@ class WebActivity(activity.Activity):
 
             return True
 
+        elif key_name in ('KP_Up', 'KP_Down', 'KP_Left', 'KP_Right'):
+            scrolled = browser.get_parent()
+
+            if key_name in ('KP_Up', 'KP_Down'):
+                adj = scrolled.get_vadjustment()
+            elif key_name in ('KP_Left', 'KP_Right'):
+                adj = scrolled.get_hadjustment()
+            value = adj.get_value()
+            step = adj.get_step_increment()
+
+            if key_name in ('KP_Up', 'KP_Left'):
+                adj.set_value(value - step)
+            elif key_name in ('KP_Down', 'KP_Right'):
+                adj.set_value(value + step)
+
+            return True
+
         return False
 
     def _add_link(self):
-- 
1.7.7.6



More information about the Sugar-devel mailing list