1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 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
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>PersistentObject</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.persist.persistencemanager.PersistentObject_inheritance.png" alt="Inheritance diagram of PersistentObject" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.persist.persistencemanager.PersistentObject.html" title="wx.lib.agw.persist.persistencemanager.PersistentObject" alt="" coords="5,5,379,35"/> </map>
</p>
|
|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() <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() <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.
|