.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.agw.persist.persistencemanager .. highlight:: python .. _wx.lib.agw.persist.persistencemanager.PersistentObject: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.persist.persistencemanager.PersistentObject** ========================================================================================================================================== :class:`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 :class:`PersistenceManager` to save and restore the object properties and implements them using the concrete class methods. You may derive your own classes from :class:`PersistentObject` to implement persistence support for your common classes, see :ref:`persistent-windows` in the `__init__.py` file. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class PersistentObject:
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.__init__` Default class constructor. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.GetKind` Returns the string uniquely identifying the objects supported by this adapter. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.GetName` Returns the string uniquely identifying the window we're associated with :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.GetWindow` Returns the actual associated window. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.Restore` Restores the corresponding window settings. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.RestoreCtrlValue` Restore the value saved by :meth:`~PersistentObject.SaveCtrlValue`, should be used only for :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.RestoreValue` Restore the value saved by :meth:`~PersistentObject.SaveValue`. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.Save` Saves the corresponding window settings. :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.SaveCtrlValue` Save the specified value using the given name, should be used only for :meth:`~wx.lib.agw.persist.persistencemanager.PersistentObject.SaveValue` Save the specified value using the given name. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: PersistentObject(object) :class:`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 :class:`PersistenceManager` to save and restore the object properties and implements them using the concrete class methods. You may derive your own classes from :class:`PersistentObject` to implement persistence support for your common classes, see :ref:`persistent-windows` in the `__init__.py` file. .. method:: __init__(self, window, persistenceHandler=None) Default class constructor. :param `window`: an instance of :class:`wx.Window`; :param `persistenceHandler`: if not ``None``, this should a custom handler derived from :class:`~wx.lib.agw.persist.persist_handlers.AbstractHandler`. .. method:: GetKind(self) Returns the string uniquely identifying the objects supported by this adapter. .. note:: This method is called from :meth:`~PersistentObject.SaveValue` and :meth:`~PersistentObject.RestoreValue` and normally returns some short (but not too cryptic) strings, e.g. "Checkbox". .. method:: 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 :meth:`~PersistentObject.GetKind` to construct the unique full name of the object in e.g. a configuration file. .. method:: GetWindow(self) Returns the actual associated window. .. method:: Restore(self) Restores the corresponding window settings. .. note:: This method shouldn't be used directly as it doesn't respect the global :meth:`PersistenceManager.DisableRestoring() ` settings, use :class:`PersistenceManager` methods with the same name instead. .. method:: RestoreCtrlValue(self, name) Restore the value saved by :meth:`~PersistentObject.SaveCtrlValue`, should be used only for controls data value. :param `name`: the same name as was used by :meth:`~PersistentObject.SaveCtrlValue`. :returns: ``True`` if the value was successfully read or ``False`` if it was not found or an error occurred. .. method:: RestoreValue(self, name) Restore the value saved by :meth:`~PersistentObject.SaveValue`. :param `name`: the same name as was used by :meth:`~PersistentObject.SaveValue`. :returns: ``True`` if the value was successfully read or ``False`` if it was not found or an error occurred. .. method:: Save(self) Saves the corresponding window settings. .. note:: This method shouldn't be used directly as it doesn't respect the global :meth:`PersistenceManager.DisableSaving() ` settings, use :class:`PersistenceManager` methods with the same name instead. .. method:: SaveCtrlValue(self, name, value) Save the specified value using the given name, should be used only for controls data value. :param `name`: the name of the value in the configuration file; :param `value`: the value to save. :returns: ``True`` if the value was saved or ``False`` if an error occurred. .. method:: SaveValue(self, name, value) Save the specified value using the given name. :param `name`: the name of the value in the configuration file; :param `value`: the value to save. :returns: ``True`` if the value was saved or ``False`` if an error occurred.