Changeset 216
- Timestamp:
- 07/16/02 16:35:39 (6 years ago)
- Files:
-
- trunk/RBSkinning/RBSkinning/XMLSkinner.py (modified) (2 diffs)
- trunk/RBSkinning/RBSkinning/__init__.py (modified) (1 diff)
- trunk/RBSkinning/RBSkinning/xmlObjectifySkin/substitute.py (added)
- trunk/RBSkinning/RBSkinning/xmlPython/evaluate.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBSkinning/RBSkinning/XMLSkinner.py
r214 r216 36 36 37 37 from Foundation.XMLClassBuilder import XMLClassBuilderMixin 38 from Foundation.XMLClassBuilder import ElementFactory as EF39 38 from Foundation.WeakBind import BindCallable 40 39 import SkinContext … … 48 47 49 48 class XMLSkinner(XMLClassBuilderMixin): 50 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~51 #~ Constants / Variables / Etc.52 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~53 54 ElementFactories = XMLClassBuilderMixin.ElementFactories.copy()55 ElementFactories.update({56 ## Long names57 ('http://namespaces.runeblade.com/skin',): EF.NodeImport('Foundation.Skinning.skin'),58 ('http://namespaces.runeblade.com/wxPythonSkin',): EF.NodeImport('Foundation.Skinning.wxPythonSkin'),59 ('http://namespaces.runeblade.com/xmlPython',): EF.NodeImport('Foundation.Skinning.xmlPython'),60 ('http://namespaces.runeblade.com/wxogl',): EF.NodeImport('Foundation.Skinning.wxOGLSkin'),61 ('http://namespaces.runeblade.com/state',): EF.NodeImport('Foundation.Skinning.StateSkin'),62 63 ('http://namespaces.runeblade.com/xmlObjectify',): EF.StaticImport('Foundation.XMLObjectify', 'ObjectifiedXML'),64 ('http://www.w3.org/1999/xhtml',): EF.StaticImport('Foundation.Skinning.xhtml.xhtml', 'xhtml'),65 66 ## Short names67 ('skin',): EF.NodeImport('Foundation.Skinning.skin'),68 ('wxPythonSkin',): EF.NodeImport('Foundation.Skinning.wxPythonSkin'),69 ('xmlPython',): EF.NodeImport('Foundation.Skinning.xmlPython'),70 ('wxogl',): EF.NodeImport('Foundation.Skinning.wxOGLSkin'),71 ('state',): EF.NodeImport('Foundation.Skinning.StateSkin'),72 73 ('xmlObjectify',): EF.StaticImport('Foundation.XMLObjectify', 'ObjectifiedXML'),74 })75 76 49 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 50 #~ Special trunk/RBSkinning/RBSkinning/__init__.py
r207 r216 34 34 35 35 from XMLSkinner import XMLSkinner as _XMLSkinner 36 from Foundation.XMLClassBuilder import ElementFactory as EF 37 38 class _XMLRobustSkinner(_XMLSkinner): 39 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 40 #~ Constants / Variables / Etc. 41 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 43 ElementFactories = _XMLSkinner.ElementFactories.copy() 44 ElementFactories.update({ 45 ## Long names 46 ('http://namespaces.runeblade.com/skin',): EF.NodeImport('Foundation.Skinning.skin'), 47 ('http://namespaces.runeblade.com/wxPythonSkin',): EF.NodeImport('Foundation.Skinning.wxPythonSkin'), 48 ('http://namespaces.runeblade.com/xmlPython',): EF.NodeImport('Foundation.Skinning.xmlPython'), 49 ('http://namespaces.runeblade.com/wxogl',): EF.NodeImport('Foundation.Skinning.wxOGLSkin'), 50 ('http://namespaces.runeblade.com/state',): EF.NodeImport('Foundation.Skinning.StateSkin'), 51 52 ('http://namespaces.runeblade.com/xmlObjectify',): EF.StaticImport('Foundation.XMLObjectify', 'ObjectifiedXML'), 53 ('http://www.w3.org/1999/xhtml',): EF.StaticImport('Foundation.Skinning.xhtml.xhtml', 'xhtml'), 54 ('http://www.w3.org/1999/xhtml','substitute'): EF.StaticImport('Foundation.Skinning.xhtml.substitute', 'substitute'), 55 56 ## Short names 57 ('skin',): EF.NodeImport('Foundation.Skinning.skin'), 58 ('wxPythonSkin',): EF.NodeImport('Foundation.Skinning.wxPythonSkin'), 59 ('xmlPython',): EF.NodeImport('Foundation.Skinning.xmlPython'), 60 ('wxogl',): EF.NodeImport('Foundation.Skinning.wxOGLSkin'), 61 ('state',): EF.NodeImport('Foundation.Skinning.StateSkin'), 62 63 ('xmlObjectify',): EF.StaticImport('Foundation.XMLObjectify', 'ObjectifiedXML'), 64 }) 65 36 66 37 67 def SkinFile(*args, **kw): 38 return _XML Skinner().SkinFile(*args, **kw)68 return _XMLRobustSkinner().SkinFile(*args, **kw) 39 69 40 70 def SkinXML(*args, **kw): 41 return _XML Skinner().SkinXML(*args, **kw)71 return _XMLRobustSkinner().SkinXML(*args, **kw) 42 72 trunk/RBSkinning/RBSkinning/xmlPython/evaluate.py
r150 r216 43 43 44 44 class evaluate(PySkinObject): 45 def ExecuteXML(self, **Variables): 45 default_settings = PySkinObject.default_settings.copy() 46 default_settings['phase'] = 'finalize' 47 48 def GetCode(self): 46 49 code = ''.join(self.Content()) 47 50 if not code.strip(): code = self.settings['code'] 48 return eval(code, self.namespace, self._getLocals(Variables)) 51 return code 52 53 def ExecuteXML(self, **Variables): 54 return eval(self.GetCode(), self.namespace, self._getLocals(Variables)) 49 55
