[Urwid] event detection question
Eric S. Johansson
esj at harvee.org
Sat Jul 15 11:46:19 EDT 2006
Ian Ward wrote:
> Another approach would be to implement a "Command pattern". All the
> user modifications to widgets could be captured as Command objects. Each
> object would have an execute() function responsible for making that
> change. Multiple repeated changes to edit widgets should be collected
> into a single Command object.
>
> With such a system you can easily tell when "the user has finished
> editing an Edit widget" or "the user has finished with this RadioButton
> group" by checking if the command being created is different than the
> previous one.
>
> Of course, the real benefit of the Command pattern is when you add a
> rollback() function and store your commands in a list. That makes it
> easy to implement multiple undo in your interface, which is a very very
> nice thing to have.
another advantage to the command pattern is that it allows you to have a
single source of data which is displayed or edited. As it stands now,
I've had to copy data in and out and keeping urwid synchronize has been
grump inspiring at best.
now I get to go learn about command patterns.
More information about the Urwid
mailing list