pdk.Gui.WidgetStateManagers ($Date: 2002/12/04 10:16:26 $)
index
pdk/Gui/WidgetStateManagers.py

Widget state management classes.

Provides automatic signalling and persistent storage of GUI widget state data.

Implementation note: it is currently not possible to have the widget classes
inherit directly from the new-style class IntegratedPropertyManager

FOG 08.2001, 08.2002

 
Classes
            
StatefulWidget
_WidgetStateManagerRegistry
 
class StatefulWidget
     
Purpose:adds automatic signalling and persistency to GUI widgets
Detail:

automatic signalling and registration services for the widget data types defined in STATETYPES.

Enabled via the .setSignallingInfo and .setRegistrationInfo methods of _WidgetStateManager, which will both call the .connectStateSignal method of the widget to connect the .onWidgetDataChange method of _WidgetStateManagerRegistry as a callback with whatever wx event should trigger the value signalling/registration and the widget`s ID string as arguments.


 
   Methods defined here:
connectStateSignal(self, callBackF)
connects the call back callBackF with a wx event to automatically signal and/or register changes in the widget value.
disconnectStateSignal(self)
disconnects any signalling- and/or registration-related callbacks previously connected with a call to .connectStateSignal from the widget.
getState(self, stateType)
returns the widget state data of type %stateType%.
initialize(self, stateType=None)
initializes the widget data for the state type given in stateType (or for all state types specified in the call to .register) from the registry. We can only initialize widgets that have been properly registered with pdk (by calling .pdk.Gui._Gui.registerWidget of the gui singleton).
isConnected(self, flag=None)
register(self, **stateTypeInfoD)

call this to register this widget directly for automatic widget data handling.

stateTypeInfoD is of the form

{ "[register,signal]<state data type>" : <state data info> }

where <state data type> is any of the strings listed in STATETYPES and <state data info> determines the way widget data are handled. A simple example would be a call like this:

register(signalvalue = 1, registersetup = 1)

which would enable signalling of the widget`s value and (read-only) registration of the widget`s setup data (see .setSignallingInfo and .setRegistrationInfo methods of _WidgetStateManager for further explanation).

We can only register widgets for managing that have been properly registered with the Gui core (by calling .pdk.Gui._Gui.registerWidget gui singleton).

Note that the state manager registry supplies methods for automatic registration/initialization of all pdk widgets (see the _WidgetStateManagerRegistry class).

setState(self, stateType, value)
sets the widget data of type stateType to value and emits a corresponding wx event.
setStateFromRegistry(self, **stateTypeInfoD)
calls .register (with %stateTypeInfoD%) and then .initialize.
store(self, stateType=None)
explicitly stores the current widget data to the registry.
 
class _WidgetStateManagerRegistry
     
Purpose:registry of global widget state manager instances

 
   Methods defined here:
getStateManager(self, stateType)
returns the state manager for %stateType%.
getStateManagers(self)
returns a list of all state managers.
onWidgetDataChange(self, event, widgetRef)
this is the main callback from wxPython to track runtime widget data changes.
setStateOfManagedWidgets(self, rootIdString='')
initializes all pdk widgets in the sub-tree rooted in the node rootIdString from the registry.
storeStateOfManagedWidgets(self, rootIdString='')
stores the current value of all pdk widgets in the sub-tree rooted in the node rootIdString to the registry.
 
Functions
            
REGISTERWIDGETSTATEDATASLOT(widget, stateType, slotObject, receiveFunc, rank)
REGISTERWIDGETSTATESETUPSLOT(widget, slotObject, receiveFunc=None, rank=None)
registers a slot that responds to GUI widget setup configuration messages
REGISTERWIDGETSTATEVALUESLOT(widget, slotObject, receiveFunc=None, rank=None)
registers a slot that responds to GUI widget value configuration messages
SENDSIGNALWIDGETSTATEDATA(widget, stateType, sendData)
SENDSIGNALWIDGETSTATESETUP(widget, sendData=None)
manually signals a GUI widget setup change
SENDSIGNALWIDGETSTATEVALUE(widget, sendData=None)
manually signals a GUI widget value change
UNREGISTERWIDGETSTATEDATASLOT(widget, stateType, slotObject)
UNREGISTERWIDGETSTATESETUPSLOT(widget, slotObject)
un-registers GUI widget setup configuration message slots
UNREGISTERWIDGETSTATEVALUESLOT(widget, slotObject)
un-registers GUI widget value configuration message slots
get_statemanager = getStateManager(self, stateType) method of _WidgetStateManagerRegistry instance
get_statemanagers = getStateManagers(self) method of _WidgetStateManagerRegistry instance
set_state_of_managed_widgets = setStateOfManagedWidgets(self, rootIdString='') method of _WidgetStateManagerRegistry instance
store_state_of_managed_widgets = storeStateOfManagedWidgets(self, rootIdString='') method of _WidgetStateManagerRegistry instance
on_widgetdata_change = onWidgetDataChange(self, event, widgetRef) method of _WidgetStateManagerRegistry instance
 
Data
             REGISTRATIONINFO_DISABLED = 0
REGISTRATIONINFO_RO = 1
REGISTRATIONINFO_RW_ONCE = 2
REGISTRATIONINFO_RW_ALWAYS = 3
STATETYPE_SETUP = 'setup'
STATETYPE_VALUE = 'value'
 
Author
            
$Author: gathmann $