Changeset 216

Show
Ignore:
Timestamp:
07/16/02 16:35:39 (6 years ago)
Author:
sholloway
Message:

Added xhtml:substitute
Moved the skinning object map out to Foundation.Skinning level, instead of the XMLSkinner.py file
Fixed py:evaluate

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBSkinning/RBSkinning/XMLSkinner.py

    r214 r216  
    3636 
    3737from Foundation.XMLClassBuilder import XMLClassBuilderMixin 
    38 from Foundation.XMLClassBuilder import ElementFactory as EF 
    3938from Foundation.WeakBind import BindCallable 
    4039import SkinContext 
     
    4847 
    4948class XMLSkinner(XMLClassBuilderMixin): 
    50     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    51     #~ Constants / Variables / Etc.  
    52     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    53  
    54     ElementFactories = XMLClassBuilderMixin.ElementFactories.copy() 
    55     ElementFactories.update({ 
    56         ## Long names 
    57         ('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 names 
    67         ('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      
    7649    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    7750    #~ Special  
  • trunk/RBSkinning/RBSkinning/__init__.py

    r207 r216  
    3434 
    3535from XMLSkinner import XMLSkinner as _XMLSkinner 
     36from Foundation.XMLClassBuilder import ElementFactory as EF 
     37 
     38class _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     
    3666 
    3767def SkinFile(*args, **kw): 
    38     return _XMLSkinner().SkinFile(*args, **kw) 
     68    return _XMLRobustSkinner().SkinFile(*args, **kw) 
    3969 
    4070def SkinXML(*args, **kw): 
    41     return _XMLSkinner().SkinXML(*args, **kw) 
     71    return _XMLRobustSkinner().SkinXML(*args, **kw) 
    4272 
  • trunk/RBSkinning/RBSkinning/xmlPython/evaluate.py

    r150 r216  
    4343 
    4444class evaluate(PySkinObject): 
    45     def ExecuteXML(self, **Variables): 
     45    default_settings = PySkinObject.default_settings.copy() 
     46    default_settings['phase'] = 'finalize' 
     47 
     48    def GetCode(self): 
    4649        code = ''.join(self.Content()) 
    4750        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)) 
    4955