本文整理汇总了Python中element.Element.insert方法的典型用法代码示例。如果您正苦于以下问题:Python Element.insert方法的具体用法?Python Element.insert怎么用?Python Element.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类element.Element
的用法示例。
在下文中一共展示了Element.insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateComponentLabel
# 需要导入模块: from element import Element [as 别名]
# 或者: from element.Element import insert [as 别名]
def generateComponentLabel(self):
if self.label == None:
return ''
label = Element('label', {
'id':self.id+'-label',
'for':self.id,
'class':self.labelClass
})
label.update(self.label)
# Add the required star to the label
if 'required' in self.validationOptions:
labelRequiredStarSpan = Element('span',
{'class':self.labelRequiredStarClass})
labelRequiredStarSpan.update(self.requiredText)
label.insert(labelRequiredStarSpan)
return label
示例2: generateComponentDiv
# 需要导入模块: from element import Element [as 别名]
# 或者: from element.Element import insert [as 别名]
def generateComponentDiv(self, includeLabel=True):
# Div tag contains everything about the component
componentDiv = Element('div', {
'id': self.id+'-wrapper',
'class': 'jFormComponent '+self._class})
# This causes issues with things that are dependent and should display by default
# If the component has dependencies and the display type is hidden, hide by default
# if(self.dependencyOptions !== None && isset(self.dependencyOptions['display']) && self.dependencyOptions['display'] == 'hide'):
# componentDiv.setAttribute('style', 'display: none')
#
# Style
if self.style:
componentDiv.addToAttribute('style', self.style)
# Label tag
if includeLabel:
label = self.generateComponentLabel()
componentDiv.insert(label)
return componentDiv