Package schrodinger :: Package ui :: Package widget :: Module pmwwidget :: Class schroPmwWrapper
[hide private]
[frames] | no frames]

Class schroPmwWrapper

Known Subclasses:

Parent class for all Schrodinger Pmw widgets. Takes care of retrieving defaults for different mega-widget classes, setting proper behavior, etc.

The class has the capability to retrieve generic defaults, environment specific defaults (environ is a possible widget argument, "dialog," "normal," etc.), and packing or grid defaults. The widget classes below provide examples of how to use the schroWidget class.

The class also has the capability of setting options for individual components of the mega-widget, ie each button of a ButtonBox, or the Listbox component of a ScrolledListBox mega-widget.

Instance Methods [hide private]
 
__init__(self, type, baseclass, parent, **kwargs)
The initialization function simply retrieves the defaults for the given mega-widget type (which includes defaults for seperate components), and intializes the mega-widget with the specified initialization function, using a combination of user-specified options and those set in defaults
 
_retrievePmwDflts(self, widgettype, **kwargs)
Method to retrieve defaults for mega-widgets.
 
_retrieveTkDflts(self, widgettype, **kwargs)
Method to retrieve defaults for tkinter components of mega-widgets.
 
_getDflts(self, widgettype, environment, **kwargs)
Method responsible for fetching defaults for widgets and mega widgets from the dflts dictionary in the widget/default module.
 
_update_placement(self, method, **kwargs)
Method used by grid() and pack() to retrive proper placement defaults for a widget (if they exist).
 
pack(self, **kwargs)
We capture the pack method of the widget so that we can add our specific defaults.
 
grid(self, **kwargs)
We capture the grid method of the widget so that we can add our specific defaults.
 
_cleanup_component(self, object, objecttype=None)
Method responsible for setting defaults for mega-widget component widgets (ie the Listbox component of a Pmw.ScrolledListBox).
 
cleanup_components(self)
Does the equivalent of running the above method _cleanup_component() on each componenet of this Pmw widget.
 
_repack_component(self, object, objecttype)
Currently unused method which is intended to modify the pack options to the defaults by repacking the object with defaults.
 
_get_clean_dflts(self, objecttype)
Called by "_cleanup_component" to retrieve defaults for the specified widget.
 
_get_geometry_defaults(self, objecttype, geo_method)
Method called by "_repack_component" to actually fetch the proper placement defaults, if they exist.
Method Details [hide private]

__init__(self, type, baseclass, parent, **kwargs)
(Constructor)

 

The initialization function simply retrieves the defaults for the given mega-widget type (which includes defaults for seperate components), and intializes the mega-widget with the specified initialization function, using a combination of user-specified options and those set in defaults

NOTE: Defaults for Pmw mega-widgets will not be overriden by user-specified options. The reason for this is that some Pmw options are "initialization" options, and can only be set upon initialization of the mega-widget. However, the defaults for individual Tkinter components will be set, and if behavior other than the default is desired, the options will have to be changed after initialization:

<pmwwidget>.component("<component_name>").config(<options>)

_retrievePmwDflts(self, widgettype, **kwargs)

 

Method to retrieve defaults for mega-widgets. Does not overwrite user-specified options. Called by __init__, and in turn calls _getDflts for actual information retrieval.

_retrieveTkDflts(self, widgettype, **kwargs)

 

Method to retrieve defaults for tkinter components of mega-widgets. User-specified options are overwritten. Called by __init__, and in turn calls _getDflts for actual information retrieval.

_getDflts(self, widgettype, environment, **kwargs)

 

Method responsible for fetching defaults for widgets and mega widgets from the dflts dictionary in the widget/default module. Called by "_retrievePmwDflts" and "_retrieveTkDflts" which are originally called by "__init__".

pack(self, **kwargs)

 

We capture the pack method of the widget so that we can add our specific defaults. After the defaults are added (user-specified options overwrite defaults), the original pack function is called.

grid(self, **kwargs)

 

We capture the grid method of the widget so that we can add our specific defaults. After the defaults are added (user-specified options overwrite defaults), the original grid function is called.

_cleanup_component(self, object, objecttype=None)

 

Method responsible for setting defaults for mega-widget component widgets (ie the Listbox component of a Pmw.ScrolledListBox). Defaults are retrieved with "_get_clean_dflts", which override any user-specified options. If behavior other than the default is desired, the options will have to be changed afterinitialization:

<pmwwidget>.component("<component_name>").config(<options>)

cleanup_components(self)

 

Does the equivalent of running the above method _cleanup_component() on each componenet of this Pmw widget. FIXME: MAY NOT WORK AS EXPECTED

_get_clean_dflts(self, objecttype)

 

Called by "_cleanup_component" to retrieve defaults for the specified widget. Combines the environment specified defaults, and the generic defaults into one dictionary which it then returns.