本文整理汇总了Python中model.Model.findResource方法的典型用法代码示例。如果您正苦于以下问题:Python Model.findResource方法的具体用法?Python Model.findResource怎么用?Python Model.findResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Model
的用法示例。
在下文中一共展示了Model.findResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createRef
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import findResource [as 别名]
def createRef(self, ref, child=None):
'''Create object_ref element node.'''
if child is None:
child = Model.createRefNode(ref)
refNode = Model.findResource(ref)
if not refNode: return None
comp = Manager.getNodeComp(refNode)
self.create(comp, child)
示例2: getNodeComp
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import findResource [as 别名]
def getNodeComp(self, node, defaultClass='unknown'):
# For ref nodes without class name, need to find ref element
cls = node.getAttribute('class')
if node.tagName == 'object_ref':
if not cls:
refNode = Model.findResource(node.getAttribute('ref'))
cls = refNode.getAttribute('class')
if defaultClass and cls not in self.components:
cls = defaultClass
return self.components[cls]
示例3: createRef
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import findResource [as 别名]
def createRef(self, ref, child=None):
"""Create object_ref element node."""
if child is None:
child = Model.createRefNode(ref)
refNode = Model.findResource(ref)
if refNode:
comp = Manager.getNodeComp(refNode)
else:
comp = Manager.getNodeComp(child)
self.create(comp, child)
示例4: getNodeComp
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import findResource [as 别名]
def getNodeComp(self, node, defaultClass='unknown'):
# For ref nodes without class name, need to find ref element
if node is Model.mainNode:
return self.rootComponent
elif node.nodeType == node.COMMENT_NODE:
return self.components['comment']
cls = node.getAttribute('class')
if node.tagName == 'object_ref':
if not cls:
refNode = Model.findResource(node.getAttribute('ref'))
if refNode:
cls = refNode.getAttribute('class')
else:
cls = 'unknown'
if defaultClass and cls not in self.components:
cls = defaultClass
return self.components[cls]