本文整理汇总了Python中element.Element.addToAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python Element.addToAttribute方法的具体用法?Python Element.addToAttribute怎么用?Python Element.addToAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类element.Element
的用法示例。
在下文中一共展示了Element.addToAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateComponentDiv
# 需要导入模块: from element import Element [as 别名]
# 或者: from element.Element import addToAttribute [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
示例2: __str__
# 需要导入模块: from element import Element [as 别名]
# 或者: from element.Element import addToAttribute [as 别名]
def __str__(self):
# Generate the component div
div = self.generateComponentDiv()
# Add the input tag
textArea = Element('textarea', {
'id':self.id,
'name':self.name,
'class':self.inputClass})
if self.width:
if self.width in self.widthArray.keys():
textArea.setAttribute('style', 'width: '+self.widthArray[self.width]+'')
else:
textArea.setAttribute('style', 'width: '+str(self.width)+'')
if self.height:
if self.height in self.heightArray.keys():
textArea.addToAttribute('style', 'height: '+self.heightArray[self.height]+'')
else:
textArea.addToAttribute('style', 'height: '+str(self.height)+'')
if self.style:
textArea.addToAttribute('style', self.style)
if self.disabled:
textArea.setAttribute('disabled', 'disabled')
if self.readOnly:
textArea.setAttribute('readonly', 'readonly')
if self.wrap:
textArea.setAttribute('wrap', self.wrap)
if self.initialValue:
textArea.update(self.initialValue)
div.insert(textArea)
# Add any description (optional)
div = self.insertComponentDescription(div)
# Add a tip (optional)
div = self.insertComponentTip(div)
return div.__str__()