.. 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
.. _wx.xrc.XmlResource:
==========================================================================================================================================
|phoenix_title| **wx.xrc.XmlResource**
==========================================================================================================================================
This is the main class for interacting with the XML-based resource system.
The class holds ``XML`` resources from one or more .xml files, binary files or zip archive files.
Note that this is a singleton class and you'll never allocate/deallocate it. Just use the static :meth:`wx.xrc.XmlResource.Get` getter.
.. seealso:: :ref:`XML Based Resource System ` , :ref:`XRC File Format `
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
Inheritance diagram for class XmlResource:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.xrc.XmlResource.__init__` Constructor.
:meth:`~wx.xrc.XmlResource.AddHandler` Initializes only a specific handler (or custom handler).
:meth:`~wx.xrc.XmlResource.AddSubclassFactory` Registers subclasses factory for use in ``XRC``.
:meth:`~wx.xrc.XmlResource.AttachUnknownControl` Attaches an unknown control to the given panel/window/dialog.
:meth:`~wx.xrc.XmlResource.ClearHandlers` Removes all handlers and deletes them (this means that any handlers added using :meth:`~XmlResource.AddHandler` must be allocated on the heap).
:meth:`~wx.xrc.XmlResource.CompareVersion` Compares the ``XRC`` version to the argument.
:meth:`~wx.xrc.XmlResource.FindXRCIDById` Returns a string ``ID`` corresponding to the given numeric ``ID``.
:meth:`~wx.xrc.XmlResource.Get` Gets the global resources object or creates one if none exists.
:meth:`~wx.xrc.XmlResource.GetDomain` Returns the domain (message catalog) that will be used to load translatable strings in the ``XRC``.
:meth:`~wx.xrc.XmlResource.GetFlags` Returns flags, which may be a bitlist of :ref:`wx.xrc.XmlResourceFlags` enumeration values.
:meth:`~wx.xrc.XmlResource.GetResourceNode` Returns the :ref:`wx.xml.XmlNode` containing the definition of the object with the given name or ``None``.
:meth:`~wx.xrc.XmlResource.GetVersion` Returns version information (a.b.c.d = d + 256c + 2562b + 2563a).
:meth:`~wx.xrc.XmlResource.GetXRCID` Returns a numeric ``ID`` that is equivalent to the string ``ID`` used in an ``XML`` resource.
:meth:`~wx.xrc.XmlResource.InitAllHandlers` Initializes handlers for all supported controls/windows.
:meth:`~wx.xrc.XmlResource.InsertHandler` Add a new handler at the begining of the handler list.
:meth:`~wx.xrc.XmlResource.Load` Loads resources from ``XML`` files that match given filemask.
:meth:`~wx.xrc.XmlResource.LoadAllFiles` Loads all .xrc files from directory `dirname`.
:meth:`~wx.xrc.XmlResource.LoadBitmap` Loads a bitmap resource from a file.
:meth:`~wx.xrc.XmlResource.LoadDialog` Loads a dialog.
:meth:`~wx.xrc.XmlResource.LoadFile` Simpler form of :meth:`~XmlResource.Load` for loading a single ``XRC`` file.
:meth:`~wx.xrc.XmlResource.LoadFrame` Loads a frame from the resource.
:meth:`~wx.xrc.XmlResource.LoadFromBuffer` Load the resource from a bytes string or other data buffer compatible object.
:meth:`~wx.xrc.XmlResource.LoadIcon` Loads an icon resource from a file.
:meth:`~wx.xrc.XmlResource.LoadMenu` Loads menu from resource.
:meth:`~wx.xrc.XmlResource.LoadMenuBar` Loads a menubar from resource.
:meth:`~wx.xrc.XmlResource.LoadObject` Load an object from the resource specifying both the resource name and the class name.
:meth:`~wx.xrc.XmlResource.LoadObjectRecursively` Load an object from anywhere in the resource tree.
:meth:`~wx.xrc.XmlResource.LoadPanel` Loads a panel.
:meth:`~wx.xrc.XmlResource.LoadToolBar` Loads a toolbar.
:meth:`~wx.xrc.XmlResource.Set` Sets the global resources object and returns a pointer to the previous one (may be ``None``).
:meth:`~wx.xrc.XmlResource.SetDomain` Sets the domain (message catalog) that will be used to load translatable strings in the ``XRC``.
:meth:`~wx.xrc.XmlResource.SetFlags` Sets flags (bitlist of :ref:`wx.xrc.XmlResourceFlags` enumeration values).
:meth:`~wx.xrc.XmlResource.Unload` This function unloads a resource previously loaded by :meth:`~XmlResource.Load` .
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.xrc.XmlResource.Domain` See :meth:`~wx.xrc.XmlResource.GetDomain` and :meth:`~wx.xrc.XmlResource.SetDomain`
:attr:`~wx.xrc.XmlResource.Flags` See :meth:`~wx.xrc.XmlResource.GetFlags` and :meth:`~wx.xrc.XmlResource.SetFlags`
:attr:`~wx.xrc.XmlResource.Version` See :meth:`~wx.xrc.XmlResource.GetVersion`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.xrc.XmlResource(Object)
**Possible constructors**::
XmlResource(filemask, flags=XRC_USE_LOCALE, domain="")
XmlResource(flags=XRC_USE_LOCALE, domain="")
This is the main class for interacting with the XML-based resource
system.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self, filemask, flags=XRC_USE_LOCALE, domain="")`
Constructor.
:param `filemask`: The ``XRC`` file, archive file, or wildcard specification that will be used to load all resource files inside a zip archive.
:type `filemask`: string
:param `flags`: One or more value of the :ref:`wx.xrc.XmlResourceFlags` enumeration.
:type `flags`: int
:param `domain`: The name of the gettext catalog to search for translatable strings. By default all loaded catalogs will be searched. This provides a way to allow the strings to only come from a specific catalog.
:type `domain`: string
**~~~**
**__init__** `(self, flags=XRC_USE_LOCALE, domain="")`
Constructor.
:param `flags`: One or more value of the :ref:`wx.xrc.XmlResourceFlags` enumeration.
:type `flags`: int
:param `domain`: The name of the gettext catalog to search for translatable strings. By default all loaded catalogs will be searched. This provides a way to allow the strings to only come from a specific catalog.
:type `domain`: string
**~~~**
.. method:: AddHandler(self, handler)
Initializes only a specific handler (or custom handler).
Convention says that the handler name is equal to the control's name plus 'XmlHandler', for example TextCtrlXmlHandler, HtmlWindowXmlHandler.
The ``XML`` resource compiler (wxxrc) can create include file that contains initialization code for all controls used within the resource. Note that this handler must be allocated on the heap, since it will be deleted by :meth:`ClearHandlers` later.
:param `handler`:
:type `handler`: wx.xrc.XmlResourceHandler
.. staticmethod:: AddSubclassFactory(factory)
Registers subclasses factory for use in ``XRC``.
This is useful only for language bindings developers who need a way to implement subclassing in wxWidgets ports that don't support ``RTTI`` (e.g. wxPython).
:param `factory`:
:type `factory`: wx.xrc.XmlSubclassFactory
.. method:: AttachUnknownControl(self, name, control, parent=None)
Attaches an unknown control to the given panel/window/dialog.
Unknown controls are used in conjunction with