]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_xrc_ex.py
1 #----------------------------------------------------------------------------
2 # The global was removed in favor of static accessor functions. This is for
3 # backwards compatibility:
5 TheXmlResource
= XmlResource_Get()
8 #----------------------------------------------------------------------------
9 # Create a factory for handling the subclass property of the object tag.
14 mod
= __import__(name
)
17 print traceback
.format_exc()
19 components
= name
.split('.')
20 for comp
in components
[1:]:
21 mod
= getattr(mod
, comp
)
25 class XmlSubclassFactory_Python(XmlSubclassFactory
):
27 XmlSubclassFactory
.__init
__(self
)
29 def Create(self
, className
):
30 assert className
.find('.') != -1, "Module name must be specified!"
31 mname
= className
[:className
.rfind('.')]
32 cname
= className
[className
.rfind('.')+1:]
33 module
= _my_import(mname
)
34 klass
= getattr(module
, cname
)
39 XmlResource_AddSubclassFactory(XmlSubclassFactory_Python())
41 #----------------------------------------------------------------------------