Hi All, I have recently started working on urwid and currently studying and playing with documentation, source code and examples. Currently i am learning to use dialogboxes, and i came to know that radiolist and checklist dialog boxes "OK" and "Cancel" buttons aren't responding to key(left/right/down) events. I made the following quick changes(don't know good or bad) and they are working now.
Following is the diff of changes
--- dialog_org.py 2010-01-25 17:29:53.000000000 +0500
+++ dialog_new.py 2010-07-14 09:07:37.137528163 +0500
@@ -43,7 +43,8 @@
('focustext','light gray','dark blue'),
]
- def __init__(self, text, height, width, body=None):
+ def __init__(self, text, height, width, body=None, un_key=None):
+ self.un_key=un_key
width = int(width)
if width <= 0:
width = ('relative', 80)
@@ -97,7 +98,7 @@
raise DialogExit(button.exitcode)
def main(self):
- self.loop = urwid.MainLoop(self.view, self.palette)
+ self.loop = urwid.MainLoop(self.view, self.palette,
unhandled_input=self.un_key)
try:
self.loop.run()
except DialogExit, e:
@@ -174,11 +175,12 @@
lb = urwid.ListBox(l)
lb = urwid.AttrWrap( lb, "selectable" )
- DialogDisplay.__init__(self, text, height, width, lb )
+ DialogDisplay.__init__(self, text, height, width, lb,
self.unhandled_key)
self.frame.set_focus('body')
-
- def unhandled_key(self, size, k):
+
+# def unhandled_key(self, size, k): #don't know what value should be
passed as size
+ def unhandled_key(self, k):
if k in ('up','page up'):
self.frame.set_focus('body')
if k in ('down','page down'):
@@ -187,7 +189,7 @@
# pass enter to the "ok" button
self.frame.set_focus('footer')
self.buttons.set_focus(0)
- self.view.keypress( size, k )
+ #self.view.keypress( size, k )
def on_exit(self, exitcode):
"""Print the tag of the item selected."""
I also attached the dialog.py with my changes.
second thing i want to know about is how to make dialogboxes independent, by
independent i mean how to display a dialogbox on an already running gui. for
example, my gui application is running and i want to display
notifications/messages to user using dialogbox, so what i need is dialogbox
should appear on my already running gui instead of drawing a new screen and
then showing the dialog box, this is what currently happening.
I need a start point on how to make dialogboxes independent(or whatever you
say).
Regards,
dialog_new.py
Description: Binary data
_______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
