PersistentObject
: ABC for anything persistent.
This is the base class for persistent object adapters.
wxPython persistence framework is non-intrusive, i.e. can work with the
classes which have no relationship to nor knowledge of it. To allow this,
an intermediate persistence adapter is used: this is just a simple object
which provides the methods used by PersistenceManager
to save and restore
the object properties and implements them using the concrete class methods.
You may derive your own classes from PersistentObject
to implement persistence
support for your common classes, see Defining Custom Persistent Windows in the
__init__.py file.
Default class constructor. |
|
Returns the string uniquely identifying the objects supported by this adapter. |
|
Returns the string uniquely identifying the window we’re associated with |
|
Returns the actual associated window. |
|
Restores the corresponding window settings. |
|
Restore the value saved by |
|
Restore the value saved by |
|
Saves the corresponding window settings. |
|
Save the specified value using the given name, should be used only for |
|
Save the specified value using the given name. |
PersistentObject
(object)¶PersistentObject
: ABC for anything persistent.
This is the base class for persistent object adapters.
wxPython persistence framework is non-intrusive, i.e. can work with the
classes which have no relationship to nor knowledge of it. To allow this,
an intermediate persistence adapter is used: this is just a simple object
which provides the methods used by PersistenceManager
to save and restore
the object properties and implements them using the concrete class methods.
You may derive your own classes from PersistentObject
to implement persistence
support for your common classes, see Defining Custom Persistent Windows in the
__init__.py file.
__init__
(self, window, persistenceHandler=None)¶Default class constructor.
window – an instance of wx.Window
;
persistenceHandler – if not None
, this should a custom handler derived
from AbstractHandler
.
GetKind
(self)¶Returns the string uniquely identifying the objects supported by this adapter.
Note
This method is called from SaveValue
and RestoreValue
and normally
returns some short (but not too cryptic) strings, e.g. “Checkbox”.
GetName
(self)¶Returns the string uniquely identifying the window we’re associated with among all the other objects of the same type.
Note
This method is used together with GetKind
to construct the unique
full name of the object in e.g. a configuration file.
GetWindow
(self)¶Returns the actual associated window.
Restore
(self)¶Restores the corresponding window settings.
Note
This method shouldn’t be used directly as it doesn’t respect the
global PersistenceManager.DisableRestoring()
settings, use PersistenceManager
methods with the same name instead.
RestoreCtrlValue
(self, name)¶Restore the value saved by SaveCtrlValue
, should be used only for
controls data value.
name – the same name as was used by SaveCtrlValue
.
True
if the value was successfully read or False
if
it was not found or an error occurred.
RestoreValue
(self, name)¶Restore the value saved by SaveValue
.
name – the same name as was used by SaveValue
.
True
if the value was successfully read or False
if
it was not found or an error occurred.
Save
(self)¶Saves the corresponding window settings.
Note
This method shouldn’t be used directly as it doesn’t respect the
global PersistenceManager.DisableSaving()
settings, use PersistenceManager
methods with the same name instead.
SaveCtrlValue
(self, name, value)¶Save the specified value using the given name, should be used only for controls data value.
name – the name of the value in the configuration file;
value – the value to save.
True
if the value was saved or False
if an error occurred.
SaveValue
(self, name, value)¶Save the specified value using the given name.
name – the name of the value in the configuration file;
value – the value to save.
True
if the value was saved or False
if an error occurred.