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
__init__ |
Default constructor. |
AddStyle |
Add a style flag (e.g. |
AddWindowStyles |
Add styles common to all Window-derived classes. |
CanHandle |
Returns True if it understands this node and can create a resource from it, False otherwise. |
CreateChildren |
Creates children. |
CreateChildrenPrivately |
Helper function. |
CreateResFromNode |
Creates a resource from a node. |
CreateResource |
Creates an object (menu, dialog, control, ...) from an XML node. |
DoCreateResource |
Called from CreateResource after variables were filled. |
GetAnimation |
Creates an animation (see wx.adv.Animation) from the filename specified in param. |
GetBitmap |
Gets a bitmap. |
GetBool |
Gets a bool flag (1, t, yes, on, True are True , everything else is False ). |
GetClass |
After CreateResource has been called this will return the class name of the XML resource node being processed. |
GetColour |
Gets colour in HTML syntax (#``RRGGBB``). |
GetCurFileSystem |
Returns the current file system. |
GetDimension |
Gets a dimension (may be in dialog units). |
GetDirection |
Gets a direction. |
GetFloat |
Gets a float value from the parameter. |
GetFont |
Gets a font. |
GetID |
Returns the wx.xrc.XRCID . |
GetIcon |
Returns an icon. |
GetIconBundle |
Returns an icon bundle. |
GetImageList |
Creates an image list from the param markup data. |
GetInstance |
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. |
GetLong |
Gets the integer value from the parameter. |
GetName |
Returns the resource name. |
GetNode |
After CreateResource has been called this will return the XML node being processed. |
GetNodeContent |
Gets node content from wx.xml.XML_ENTITY_NODE . |
GetParamNode |
Finds the node or returns None . |
GetParamValue |
Finds the parameter value or returns the empty string. |
GetParent |
After CreateResource has been called this will return the current item’s parent, if any. |
GetParentAsWindow |
After CreateResource has been called this will return the item’s parent as a wx.Window. |
GetPosition |
Gets the position (may be in dialog units). |
GetResource |
After CreateResource has been called this will return the current wx.xrc.XmlResource object. |
GetSize |
Gets the size (may be in dialog units). |
GetStyle |
Gets style flags from text in form “flag | flag2| flag3 |...” Only understands flags added with AddStyle . |
GetText |
Gets text from param and does some conversions |
HasParam |
Check to see if a parameter exists. |
IsOfClass |
Convenience function. |
ReportError |
Reports error in XRC resources to the user. |
ReportParamError |
Like ReportError , but uses the node of parameter param of the currently processed object as the context. |
SetParentResource |
Sets the parent resource. |
SetupWindow |
Sets common window options. |
Animation |
See GetAnimation |
Bitmap |
See GetBitmap |
Class |
See GetClass |
CurFileSystem |
See GetCurFileSystem |
Font |
See GetFont |
ID |
See GetID |
Icon |
See GetIcon |
ImageList |
See GetImageList |
Instance |
See GetInstance |
Name |
See GetName |
Node |
See GetNode |
Parent |
See GetParent |
ParentAsWindow |
See GetParentAsWindow |
Position |
See GetPosition |
Resource |
See GetResource |
Size |
See GetSize |
Style |
See GetStyle |
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.
Parameters: |
|
---|
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.
Parameters: | node (wx.xml.XmlNode) – |
---|---|
Return type: | 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.
Parameters: |
|
---|
CreateChildrenPrivately
(self, parent, rootnode=None)¶Helper function.
Parameters: |
|
---|
CreateResFromNode
(self, node, parent, instance=None)¶Creates a resource from a node.
Parameters: |
|
---|---|
Return type: |
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.
Parameters: |
|
---|---|
Return type: |
DoCreateResource
(self)¶Called from CreateResource after variables were filled.
Return type: | wx.Object |
---|
GetAnimation
(self, param="animation")¶Creates an animation (see wx.adv.Animation) from the filename specified in param.
Parameters: | param (string) – |
---|---|
Return type: | wx.adv.Animation |
GetBitmap
(self, *args, **kw)¶GetBitmap (self, param=”bitmap”, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets a bitmap.
Parameters: |
|
---|---|
Return type: |
GetBitmap (self, node, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets a bitmap from an XmlNode.
Parameters: |
|
---|---|
Return type: |
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
).
Parameters: |
|
---|---|
Return type: | bool |
GetClass
(self)¶After CreateResource has been called this will return the class name of the XML
resource node being processed.
Return type: | string |
---|
New in version 2.9.5.
GetColour
(self, param, defaultColour=NullColour)¶Gets colour in HTML syntax (#``RRGGBB``).
Parameters: |
|
---|---|
Return type: |
GetCurFileSystem
(self)¶Returns the current file system.
Return type: | wx.FileSystem |
---|
GetDimension
(self, param, defaultv=0, windowToUse=0)¶Gets a dimension (may be in dialog units).
Parameters: |
|
---|---|
Return type: | 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
.
Parameters: |
|
---|---|
Return type: |
New in version 2.9.3.
GetFloat
(self, param, defaultv=0)¶Gets a float value from the parameter.
Parameters: |
|
---|---|
Return type: | float |
GetID
(self)¶Returns the wx.xrc.XRCID
.
Return type: | int |
---|
GetIcon
(self, *args, **kw)¶GetIcon (self, param=”icon”, defaultArtClient=ART_OTHER, size=DefaultSize)
Returns an icon.
Parameters: |
|
---|---|
Return type: |
GetIcon (self, node, defaultArtClient=ART_OTHER, size=DefaultSize)
Gets an icon from an XmlNode.
Parameters: |
|
---|---|
Return type: |
New in version 2.9.1.
GetIconBundle
(self, param, defaultArtClient=ART_OTHER)¶Returns an icon bundle.
Parameters: |
|
---|---|
Return type: |
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.
Parameters: | param (string) – |
---|---|
Return type: | wx.ImageList |
Returns: | 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.
Return type: | wx.Object |
---|
New in version 2.9.5.
GetLong
(self, param, defaultv=0)¶Gets the integer value from the parameter.
Parameters: |
|
---|---|
Return type: | long |
GetName
(self)¶Returns the resource name.
Return type: | string |
---|
GetNode
(self)¶After CreateResource has been called this will return the XML
node being processed.
Return type: | wx.xml.XmlNode |
---|
New in version 2.9.5.
GetNodeContent
(self, node)¶Gets node content from wx.xml.XML_ENTITY_NODE
.
Parameters: | node (wx.xml.XmlNode) – |
---|---|
Return type: | string |
GetParamNode
(self, param)¶Finds the node or returns None
.
Parameters: | param (string) – |
---|---|
Return type: | wx.xml.XmlNode |
GetParamValue
(self, *args, **kw)¶GetParamValue (self, param)
Finds the parameter value or returns the empty string.
Parameters: | param (string) – |
---|---|
Return type: | string |
GetParamValue (self, node)
Returns the node parameter value.
Parameters: | node (wx.xml.XmlNode) – |
---|---|
Return type: | string |
New in version 2.9.1.
GetParent
(self)¶After CreateResource has been called this will return the current item’s parent, if any.
Return type: | wx.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.
Return type: | wx.Window |
---|
New in version 2.9.5.
GetPosition
(self, param="pos")¶Gets the position (may be in dialog units).
Parameters: | param (string) – |
---|---|
Return type: | wx.Point |
GetResource
(self)¶After CreateResource has been called this will return the current wx.xrc.XmlResource object.
Return type: | wx.xrc.XmlResource |
---|
New in version 2.9.5.
GetSize
(self, param="size", windowToUse=0)¶Gets the size (may be in dialog units).
Parameters: |
|
---|---|
Return type: |
GetStyle
(self, param="style", defaults=0)¶Gets style flags from text in form “flag | flag2| flag3 |...” Only understands flags added with AddStyle
.
Parameters: |
|
---|---|
Return type: | int |
GetText
(self, param, translate=True)¶Gets text from param and does some conversions:
$
by and
$$
by $
(needed for _File
to File
translation because of XML
syntax)Parameters: |
|
---|---|
Return type: |
|
HasParam
(self, param)¶Check to see if a parameter exists.
Parameters: | param (string) – |
---|---|
Return type: | bool |
IsOfClass
(self, node, classname)¶Convenience function.
Returns True
if the node has a property class equal to classname, e.g. object class=”wxDialog”.
Parameters: |
|
---|---|
Return type: | 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.
Parameters: |
|
---|
New in version 2.9.0.
ReportError (self, message)
Like ReportError
, but uses the node of currently processed object (m_node) as the context.
Parameters: | 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.
Parameters: |
|
---|
New in version 2.9.0.
SetParentResource
(self, res)¶Sets the parent resource.
Parameters: | res (wx.xrc.XmlResource) – |
---|
Animation
¶See GetAnimation
CurFileSystem
¶See GetCurFileSystem
ImageList
¶See GetImageList
Instance
¶See GetInstance
ParentAsWindow
¶Position
¶See GetPosition
Resource
¶See GetResource