changeset 7:80f0e17208ba

Feature wish 8. Fn is like <ESC>-n
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 31 Jul 2008 23:49:05 +0200
parents 58a887531e6e
children 20414d892f04
files ChangeLog getan
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 31 23:05:39 2008 +0200
+++ b/ChangeLog	Thu Jul 31 23:49:05 2008 +0200
@@ -1,3 +1,8 @@
+2008-07-31	Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* getan: Feature wish 8: F1 is like <ESC>-1, F2 is like <ESC>-2
+	  to F10 is like <ESC>-0.
+
 2008-07-31	Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* getan: Feature wish 4: in +/- time defaults to minutes.
--- a/getan	Thu Jul 31 23:05:39 2008 +0200
+++ b/getan	Thu Jul 31 23:49:05 2008 +0200
@@ -151,6 +151,19 @@
         total += int(v) * factor
     return total
 
+ESC_MAP = {
+    curses.KEY_F1 : ord('1'),
+    curses.KEY_F2 : ord('2'),
+    curses.KEY_F3 : ord('3'),
+    curses.KEY_F4 : ord('4'),
+    curses.KEY_F5 : ord('5'),
+    curses.KEY_F6 : ord('6'),
+    curses.KEY_F7 : ord('7'),
+    curses.KEY_F8 : ord('8'),
+    curses.KEY_F9 : ord('9'),
+    curses.KEY_F10: ord('0'),
+}
+
 ZERO = timedelta(0)
 
 class UTC(tzinfo):
@@ -430,6 +443,11 @@
             tolerantClose(cur)
 
     def pausedState(self, c):
+        c2 = ESC_MAP.get(c)
+        if c2:
+            self.pausedEscapeState(c2)
+            return
+
         global stdscr
         if c in (curses.KEY_DC, curses.KEY_BACKSPACE):
             stdscr.erase()
@@ -507,6 +525,11 @@
 
     def runningState(self, c):
         global stdscr
+        c2 = ESC_MAP.get(c)
+        if c2:
+            self.runningEscapeState(c2)
+            return
+
         if c == curses.ascii.ESC:
             self.state = RUNNING_ESC
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)