Saketh Bhamidipati:
Frank Niessink:
What is confusing you?
The pattern's implementation. Although I understand the
theoretical ideas behind it, I've been unable to find a simple example
of the pattern in action. In Task Coach, the pattern is buried
under many layers of abstraction that I'm still trying to dig through.
Yes, I might have done things a bit over the top there. :-/
The pattern is the pattern that I have the most experience
with, ironically. However, I have never implemented it. I am assuming
that the publisher/subscriber paradigm is a version of the
pattern, or vice versa. Again, what confuses me is the implementation.
Agreed, in my view observer/observables == publish/subscribe.
Am I supposed to write and mixins? In that case, I
suppose that the wx.Frame subclass would also inherit the
mixin, and the wx.Menu and wx.MenuBar subclasses would inherit the
mixins.
If you are interested in the 'UICommand' class as a means to decouple
actions from menu/toolbar on the one hand and domain objects on the
other hand, you don't need to use the classes at all.
The basic idea is this: a UICommand is an action that a user can invoke
through a menu item or a toolbar item. You can bind it to one or more
meu items and to toolbar items. It contains all information that is
needed for that, such as the menu text, the help text, the bitmap to
use, the menu type (wx.ITEM_NRMAL by default) and optionally a stock id
(e.g. wx.ID_SAVE for the save menu item/toolbar button). For each user
command you want to have in your application, you override the base
class and implement the doCommand() method to perform the actual work.
In Task Coach this usually means calling some method on a domain class
or on a controller.
There are a lot of subclasses of UICommand, most of which are the result
of removing duplication between the different actual ui commands. I
would advise to start with something like the UICommand base class and
only use what you really need.
Cheers, Frank
To unsubscribe, e-mail: wxPython-users-unsubscribe (AT) lists (DOT) wxwidgets.org
For additional commands, e-mail: wxPython-users-help (AT) lists (DOT) wxwidgets.org