Marco Giusti | 18 Jan 2012 22:14
X-Face
Picon
Gravatar

an idea about dialogs

attached an idea that comes to me about dialogs, but sadly it does not
work, may you can help me to investigate why. what is nice about this
idea is that a dialog freeze the normal program execution the following
logic could be implemented:

	dialog = YesNoDialog()
	ret = dialog.run()
	if ret = 'yes':
		...
	elif ret == 'no':
		...
Attachment (2loops.py): text/x-python, 803 bytes
_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
Ian Ward | 22 Jan 2012 12:17
Favicon
Gravatar

Re: an idea about dialogs

It's a problem in any event-driven system.  You can't block and still call other things that need to happen.

One trick twisted has is an inline callback that uses generators to allow code that seems like it's blocking.

If you are using the default SelectEventLoop you might be able to run the dialog as its own MainLoop that exits when its done and returns control to the first (note: I haven't actually tried this)

Ian

On Jan 19, 2012 6:14 AM, "Marco Giusti" <marco.giusti <at> gmail.com> wrote:
attached an idea that comes to me about dialogs, but sadly it does not
work, may you can help me to investigate why. what is nice about this
idea is that a dialog freeze the normal program execution the following
logic could be implemented:

       dialog = YesNoDialog()
       ret = dialog.run()
       if ret = 'yes':
               ...
       elif ret == 'no':
               ...

_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid

_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid

Gmane