SizerXmlHandler is a class for resource handlers capable of creating a wx.Sizer object from an XML
node.
wx.xrc.XmlResourceHandler is an abstract base class for resource handlers capable of creating a control from an XML
node.
See XML Based Resource System for details.
See also
Default constructor. |
|
Add a style flag (e.g. |
|
Add styles common to all Window-derived classes. |
|
Returns |
|
Creates children. |
|
Helper function. |
|
Creates a resource from a node. |
|
Creates an object (menu, dialog, control, …) from an |
|
Called from CreateResource after variables were filled. |
|
Creates an animation (see wx.adv.Animation) from the filename specified in param. |
|
Gets a bitmap. |
|
Gets a bool flag (1, t, yes, on, |
|
After CreateResource has been called this will return the class name of the |
|
Gets colour in HTML syntax (#``RRGGBB``). |
|
Returns the current file system. |
|
Gets a dimension (may be in dialog units). |
|
Gets a direction. |
|
Gets a float value from the parameter. |
|
Gets a font. |
|
Returns the |
|
Returns an icon. |
|
Returns an icon bundle. |
|
Creates an image list from the param markup data. |
|
After CreateResource has been called this will return the instance that the |
|
Gets the integer value from the parameter. |
|
Returns the resource name. |
|
After CreateResource has been called this will return the |
|
Gets node content from |
|
Finds the node or returns |
|
Finds the parameter value or returns the empty string. |
|
After CreateResource has been called this will return the current item’s parent, if any. |
|
After CreateResource has been called this will return the item’s parent as a wx.Window. |
|
Gets the position (may be in dialog units). |
|
After CreateResource has been called this will return the current wx.xrc.XmlResource object. |
|
Gets the size (may be in dialog units). |
|
Gets style flags from text in form “flag | flag2| flag3 |…” Only understands flags added with |
|
Gets text from param and does some conversions |
|
Check to see if a parameter exists. |
|
Convenience function. |
|
Reports error in |
|
Like |
|
Sets the parent resource. |
|
Sets common window options. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
wx.xrc.
XmlResourceHandler
(Object)¶Possible constructors:
XmlResourceHandler()
SizerXmlHandler is a class for resource handlers capable of creating
a Sizer object from an XML
node.
__init__
(self)¶Default constructor.
AddStyle
(self, name, value)¶Add a style flag (e.g.
MB_DOCKABLE
) to the list of flags understood by this handler.
name (string) –
value (int) –
AddWindowStyles
(self)¶Add styles common to all Window-derived classes.
CanHandle
(self, node)¶Returns True
if it understands this node and can create a resource from it, False
otherwise.
node (wx.xml.XmlNode) –
bool
Note
You must not call any wx.xrc.XmlResourceHandler methods except IsOfClass
from this method! The instance is not yet initialized with node data at the time CanHandle
is called and it is only safe to operate on node directly or to call IsOfClass
.
CreateChildren
(self, parent, this_hnd_only=False)¶Creates children.
parent (wx.Object) –
this_hnd_only (bool) –
CreateChildrenPrivately
(self, parent, rootnode=None)¶Helper function.
parent (wx.Object) –
rootnode (wx.xml.XmlNode) –
CreateResFromNode
(self, node, parent, instance=None)¶Creates a resource from a node.
node (wx.xml.XmlNode) –
parent (wx.Object) –
instance (wx.Object) –
Object
CreateResource
(self, node, parent, instance)¶Creates an object (menu, dialog, control, …) from an XML
node.
Should check for validity. parent is a higher-level object (usually window, dialog or panel) that is often necessary to create the resource.
If instance is not None
it should not create a new instance via ‘new’ but should rather use this one, and call its Create method.
node (wx.xml.XmlNode) –
parent (wx.Object) –
instance (wx.Object) –
Object
DoCreateResource
(self)¶Called from CreateResource after variables were filled.
Object
GetAnimation
(self, param="animation")¶Creates an animation (see wx.adv.Animation) from the filename specified in param.
param (string) –
GetBitmap
(self, *args, **kw)¶GetBitmap (self, param=”bitmap”, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets a bitmap.
GetBitmap (self, node, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets a bitmap from an XmlNode.
node (wx.xml.XmlNode) –
defaultArtClient (wx.ArtClient) –
size (wx.Size) –
New in version 2.9.1.
GetBool
(self, param, defaultv=False)¶Gets a bool flag (1, t, yes, on, True
are True
, everything else is False
).
param (string) –
defaultv (bool) –
bool
GetClass
(self)¶After CreateResource has been called this will return the class name of the XML
resource node being processed.
string
New in version 2.9.5.
GetColour
(self, param, defaultColour=NullColour)¶Gets colour in HTML syntax (#``RRGGBB``).
param (string) –
defaultColour (wx.Colour) –
Colour
GetCurFileSystem
(self)¶Returns the current file system.
FileSystem
GetDimension
(self, param, defaultv=0, windowToUse=0)¶Gets a dimension (may be in dialog units).
param (string) –
defaultv (int) –
windowToUse (wx.Window) –
wx.Coord
GetDirection
(self, param, dirDefault=LEFT)¶Gets a direction.
If the given param is not present or has empty value, dirDefault is returned by default. Otherwise the value of the parameter is parsed and a warning is generated if it’s not one of LEFT
, TOP
, RIGHT
or BOTTOM
.
param (string) –
dirDefault (Direction) –
New in version 2.9.3.
GetFloat
(self, param, defaultv=0)¶Gets a float value from the parameter.
param (string) –
defaultv (float) –
float
GetID
(self)¶Returns the wx.xrc.XRCID
.
int
GetIcon
(self, *args, **kw)¶GetIcon (self, param=”icon”, defaultArtClient=ART_OTHER, size=DefaultSize)
Returns an icon.
GetIcon (self, node, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets an icon from an XmlNode.
node (wx.xml.XmlNode) –
defaultArtClient (wx.ArtClient) –
size (wx.Size) –
New in version 2.9.1.
GetIconBundle
(self, param, defaultArtClient=ART_OTHER)¶Returns an icon bundle.
param (string) –
defaultArtClient (wx.ArtClient) –
IconBundle
New in version 2.9.0.
Note
Bundles can be loaded either with stock IDs or from files that contain more than one image (e.g. Windows icon files). If a file contains only single image, a bundle with only one icon will be created.
GetImageList
(self, param="imagelist")¶Creates an image list from the param markup data.
param (string) –
The new instance of wx.ImageList or None
if no data is found.
New in version 2.9.1.
GetInstance
(self)¶After CreateResource has been called this will return the instance that the XML
resource content should be created upon, if it has already been created.
If None
then the handler should create the object itself.
Object
New in version 2.9.5.
GetLong
(self, param, defaultv=0)¶Gets the integer value from the parameter.
param (string) –
defaultv (long) –
long
GetName
(self)¶Returns the resource name.
string
GetNode
(self)¶After CreateResource has been called this will return the XML
node being processed.
New in version 2.9.5.
GetNodeContent
(self, node)¶Gets node content from wx.xml.XML_ENTITY_NODE
.
node (wx.xml.XmlNode) –
string
GetParamNode
(self, param)¶Finds the node or returns None
.
param (string) –
GetParamValue
(self, *args, **kw)¶GetParamValue (self, param)
Finds the parameter value or returns the empty string.
param (string) –
string
GetParamValue (self, node)
Returns the node parameter value.
node (wx.xml.XmlNode) –
string
New in version 2.9.1.
GetParent
(self)¶After CreateResource has been called this will return the current item’s parent, if any.
Object
New in version 2.9.5.
GetParentAsWindow
(self)¶After CreateResource has been called this will return the item’s parent as a wx.Window.
Window
New in version 2.9.5.
GetPosition
(self, param="pos")¶Gets the position (may be in dialog units).
param (string) –
Point
GetResource
(self)¶After CreateResource has been called this will return the current wx.xrc.XmlResource object.
New in version 2.9.5.
GetSize
(self, param="size", windowToUse=0)¶Gets the size (may be in dialog units).
GetStyle
(self, param="style", defaults=0)¶Gets style flags from text in form “flag | flag2| flag3 |…” Only understands flags added with AddStyle
.
param (string) –
defaults (int) –
int
GetText
(self, param, translate=True)¶Gets text from param and does some conversions:
replaces \n, \r, \t by respective characters (according to C syntax)
replaces $
by and
$$
by $
(needed for _File
to File
translation because of XML
syntax)
calls GetTranslations (unless disabled in wx.xrc.XmlResource)
param (string) –
translate (bool) –
string
HasParam
(self, param)¶Check to see if a parameter exists.
param (string) –
bool
IsOfClass
(self, node, classname)¶Convenience function.
Returns True
if the node has a property class equal to classname, e.g. object class=”wxDialog”.
node (wx.xml.XmlNode) –
classname (string) –
bool
ReportError
(self, *args, **kw)¶ReportError (self, context, message)
Reports error in XRC
resources to the user.
See wx.xrc.XmlResource.ReportError
for more information.
context (wx.xml.XmlNode) –
message (string) –
New in version 2.9.0.
ReportError (self, message)
Like ReportError
, but uses the node of currently processed object (m_node) as the context.
message (string) –
New in version 2.9.0.
ReportParamError
(self, param, message)¶Like ReportError
, but uses the node of parameter param of the currently processed object as the context.
This is convenience function for reporting errors in particular parameters.
param (string) –
message (string) –
New in version 2.9.0.
SetParentResource
(self, res)¶Sets the parent resource.
res (wx.xrc.XmlResource) –
Animation
¶See GetAnimation
CurFileSystem
¶See GetCurFileSystem
ImageList
¶See GetImageList
Instance
¶See GetInstance
ParentAsWindow
¶Position
¶See GetPosition
Resource
¶See GetResource