tuikit/backend_curses.py
changeset 4 d197ca00496f
parent 3 33ec838dc021
child 5 ae128c885d0f
--- a/tuikit/backend_curses.py	Wed Mar 16 15:19:05 2011 +0100
+++ b/tuikit/backend_curses.py	Fri Mar 18 20:14:44 2011 +0100
@@ -36,30 +36,37 @@
         (0x09,                      'tab'           ),
         (0x0a,                      'enter'         ),
         (0x7f,                      'backspace'     ),
+        (0x1b,                      'escape'        ),
         (0x1b,0x4f,0x50,            'f1'            ),
         (0x1b,0x4f,0x51,            'f2'            ),
         (0x1b,0x4f,0x52,            'f3'            ),
         (0x1b,0x4f,0x53,            'f4'            ),
-        (0x1b,0x5b,0x4d,            'mouse'         ),
-        (0x1b,0x5b,0x41,            'up'            ),
-        (0x1b,0x5b,0x42,            'down'          ),
-        (0x1b,0x5b,0x43,            'right'         ),
-        (0x1b,0x5b,0x44,            'left'          ),
         (0x1b,0x5b,0x31,0x35,0x7e,  'f5'            ),
         (0x1b,0x5b,0x31,0x37,0x7e,  'f6'            ),
         (0x1b,0x5b,0x31,0x38,0x7e,  'f7'            ),
         (0x1b,0x5b,0x31,0x39,0x7e,  'f8'            ),
+        (0x1b,0x5b,0x31,0x7e,       'home'          ),  # linux
         (0x1b,0x5b,0x32,0x30,0x7e,  'f9'            ),
         (0x1b,0x5b,0x32,0x31,0x7e,  'f10'           ),
         (0x1b,0x5b,0x32,0x33,0x7e,  'f11'           ),
         (0x1b,0x5b,0x32,0x34,0x7e,  'f12'           ),
         (0x1b,0x5b,0x32,0x7e,       'insert'        ),
         (0x1b,0x5b,0x33,0x7e,       'delete'        ),
+        (0x1b,0x5b,0x34,0x7e,       'end'           ),  # linux
         (0x1b,0x5b,0x35,0x7e,       'pageup'        ),
         (0x1b,0x5b,0x36,0x7e,       'pagedown'      ),
+        (0x1b,0x5b,0x41,            'up'            ),
+        (0x1b,0x5b,0x42,            'down'          ),
+        (0x1b,0x5b,0x43,            'right'         ),
+        (0x1b,0x5b,0x44,            'left'          ),
         (0x1b,0x5b,0x46,            'end'           ),
         (0x1b,0x5b,0x48,            'home'          ),
-        (0x1b,                      'escape'        ),
+        (0x1b,0x5b,0x4d,            'mouse'         ),
+        (0x1b,0x5b,0x5b,0x41,       'f1'            ),  # linux
+        (0x1b,0x5b,0x5b,0x42,       'f2'            ),  # linux
+        (0x1b,0x5b,0x5b,0x43,       'f3'            ),  # linux
+        (0x1b,0x5b,0x5b,0x44,       'f4'            ),  # linux
+        (0x1b,0x5b,0x5b,0x45,       'f5'            ),  # linux
     )
 
     def __init__(self, screen):
@@ -343,7 +350,11 @@
 
 
     def process_mouse(self):
-        id, x, y, z, bstate = curses.getmouse()
+        try:
+            id, x, y, z, bstate = curses.getmouse()
+        except curses.error:
+            return []
+
         ev = MouseEvent(x, y)
 
         out = []