Being interested in the hachoir file dissector (http://www.hachoir.org)
I managed to compile a _curses-Module under Windows using pdcurses
(http://pdcurses.sourceforge.net/).
This started running quite fine but didn't accept any special keys and
additionally didn't recognize Enter.

Please consider the attached patch against urwid-0.9.6 for rectifying
this behaviour.

Cheers,

Gottfried
diff -ruN urwid.org/curses_display.py urwid/curses_display.py
--- urwid.org/curses_display.py	2006-08-23 05:50:06.000000000 +0200
+++ urwid/curses_display.py	2006-08-23 11:14:10.984000000 +0200
@@ -174,7 +174,7 @@
 			curses.noecho()
 			curses.meta(1)
 			curses.halfdelay(10) # don't wait longer than 1s for keypress
-			self.s.keypad(0)
+			self.s.keypad(hasattr (sys, "getwindowsversion"))
 			self.s.scrollok(1)
 			return fn()
 		finally:
@@ -263,7 +263,7 @@
 			
 		return self.s.getch()
 
-	def set_input_timeouts(self, max_wait=0.5, complete_wait=0.1, 
+	def set_input_timeouts(self, max_wait=0.1, complete_wait=0.1, 
 		resize_wait=0.1):
 		"""
 		Set the get_input timeout values.  All values have a granularity

diff -ruN urwid.org/escape.py urwid/escape.py
--- urwid.org/escape.py	2006-08-23 05:50:06.000000000 +0200
+++ urwid/escape.py	2006-08-23 11:08:19.655875000 +0200
@@ -208,7 +208,8 @@
 	360:'end',
 }
 
-
+if os.name == 'nt':     # Windows
+	_keyconv [13] = 'enter'
 
 def process_keyqueue(keys, more_fn):
 	code = keys.pop(0)
_______________________________________________
Urwid mailing list
Urwid@lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to