[pypy-svn] r9666 - pypy/dist/pypy/translator/tool/pygame

pedronis at codespeak.net pedronis at codespeak.net
Sat Mar 5 17:39:03 CET 2005


Author: pedronis
Date: Sat Mar  5 17:39:03 2005
New Revision: 9666

Modified:
   pypy/dist/pypy/translator/tool/pygame/graphdisplay.py
Log:
allow to use the space-bar and not only the clicks to follow word links



Modified: pypy/dist/pypy/translator/tool/pygame/graphdisplay.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pygame/graphdisplay.py	(original)
+++ pypy/dist/pypy/translator/tool/pygame/graphdisplay.py	Sat Mar  5 17:39:03 2005
@@ -99,6 +99,7 @@
         'shift up' : ('fast_pan', (0, -1)),
         'shift down' : ('fast_pan', (0, 1)),
         'help': 'help',
+        'space': 'hit',
     }
 
     HELP_MSG = """
@@ -112,6 +113,8 @@
         Arrows          Scroll
         Shift+Arrows    Scroll faster
 
+        Space           Follow word link
+
         Backspace       Go back in history
         Meta Left       Go back in history
         Meta Right      Go forward in history
@@ -276,6 +279,18 @@
             if text != old_text:
                 draw(prompt + text)
 
+    def hit(self):
+        word = self.highlight_word
+        if word is not None:
+            if word in self.layout.links:
+                self.setstatusbar('loading...')
+                self.redraw_now()
+                newlayout = self.layout.followlink(word)
+                if newlayout is not None:
+                    self.setlayout(newlayout)
+                    return
+                self.setstatusbar('')
+
     def search(self):
         searchstr = self.input('Find: ')
         if not searchstr:



More information about the Pypy-commit mailing list