[Pygui] Some other way to validate menu items on Cocoa?

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Jan 22 22:36:51 CET 2012


Matt Campbell wrote:
> I just found the answer to my own question. The solution is to call 
> 'validateUserInterfaceItem:'.
> 
> I wonder, though, if PyGUI needs to be more hands-off here. As I 
> mentioned in my previous post, it appears that Cocoa automatically takes 
> care of enabling and disabling standard menu items, such as those on the 
> Edit menu.

The problem is that PyGUI has its own way of handling the
enabling of menu items, and somehow this needs to be made to
dovetail with what Cocoa does.

For example, the user should be able to create a subclass of
TextField and override its setup_menus() method to modify the
conditions for enabling edit commands.

The only way I can think of to make that possible is to
intercept Cocoa's attempts to find out which commands to
enable, funnel them through the setup_menus mechanism, and
then call the appropriate underlying Cocoa methods from
the setup_menus methods.

-- 
Greg


More information about the Pygui mailing list