]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/contrib/xrc/_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. 
  13     mod 
= __import__(name
) 
  14     components 
= name
.split('.') 
  15     for comp 
in components
[1:]: 
  16         mod 
= getattr(mod
, comp
) 
  20 class XmlSubclassFactory_Python(XmlSubclassFactory
): 
  22         XmlSubclassFactory
.__init
__(self
) 
  24     def Create(self
, className
): 
  25         assert className
.find('.') != -1, "Module name must be specified!" 
  26         mname 
= className
[:className
.rfind('.')] 
  27         cname 
= className
[className
.rfind('.')+1:] 
  28         module 
= _my_import(mname
) 
  29         klass 
= getattr(module
, cname
) 
  34 XmlResource_AddSubclassFactory(XmlSubclassFactory_Python()) 
  36 #----------------------------------------------------------------------------