本文整理汇总了Python中pyasm.web.SpanWdg.add_attr方法的典型用法代码示例。如果您正苦于以下问题:Python SpanWdg.add_attr方法的具体用法?Python SpanWdg.add_attr怎么用?Python SpanWdg.add_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.SpanWdg
的用法示例。
在下文中一共展示了SpanWdg.add_attr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SpanWdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_attr [as 别名]
else:
link_rel_path = "%s" % (href)
target = xml.get_attribute(node, "target")
if target:
target = xml.set_attribute(node, "href", "/doc/%s" % link_rel_path)
continue
# get a unique id for the node
unique_id = my.top.generate_unique_id(base='replace')
xml.set_attribute(node, "id", unique_id)
div = SpanWdg()
elements.append(div)
div.add_class("spt_replace_element")
div.add_attr("spt_replace_id", unique_id)
div.add_class("hand")
div.add_class("spt_link")
div.add_color("background", "background")
text = xml.get_node_value(node)
div.add(text)
div.add_behavior( {
'type': 'click_up',
'rel_path': link_rel_path,
'cbjs_action': '''
spt.help.set_top();
spt.help.load_rel_path( bvr.rel_path );
'''
} )
示例2: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_attr [as 别名]
def get_display(my):
top = DivWdg()
element_name = my.kwargs.get('element_name')
config_view = my.kwargs.get("config_view")
display_class = config_view.get_display_handler(element_name)
display_options = config_view.get_display_options(element_name)
element_attr = config_view.get_element_attributes(element_name)
name = element_attr.get('name')
edit = element_attr.get('edit')
title = element_attr.get('title')
width = element_attr.get('width')
# add the name
from pyasm.web import Table
table = Table()
top.add(table)
table.add_row()
td = table.add_cell("Name: ")
td.add_style("padding: 5px")
name_text = SpanWdg(name)
name_text.add_style('font-weight: bold')
name_text.add_attr("size", "50")
table.add_cell(name_text)
table.add_row_cell("<br/>Element Attributes:<br/>")
# add the title
table.add_row()
td = table.add_cell("Title: ")
td.add_style("padding: 5px")
title_text = TextWdg("title")
title_text.add_attr("size", "50")
if title:
title_text.set_value(title)
table.add_cell(title_text)
# add the width
table.add_row()
td = table.add_cell("Width: ")
td.add_style("padding: 5px")
width_text = TextWdg("width")
if width:
width_text.set_value(width)
width_text.add_attr("size", "50")
table.add_cell(width_text)
# add the editable
table.add_row()
td = table.add_cell("Editable: ")
td.add_style("padding: 5px")
editable_text = CheckboxWdg("editable")
editable_text.add_attr("size", "50")
table.add_cell(editable_text)
table.add_row_cell("<br/>Display:<br/>")
# add the widget
table.add_row()
td = table.add_cell("Widget: ")
td.add_style("padding: 5px")
widget_select = SelectWdg("widget")
options = ['Expression']
widget_select.set_option("values", options)
widget_select.add_empty_option("-- Select --")
#widget_select.set_value(display_class)
table.add_cell(widget_select)
table.add_row_cell(" - or -")
# add the class
table.add_row()
td = table.add_cell("Class Name: ")
td.add_style("padding: 5px")
class_text = TextWdg("class_name")
class_text.set_value(display_class)
class_text.add_attr("size", "50")
table.add_cell(class_text)
# introspect the widget
if not display_class:
display_class = "pyasm.widget.SimpleTableElementWdg"
#display_class = "tactic.ui.panel.ViewPanelWdg"
from pyasm.common import Common
import_stmt = Common.get_import_from_class_path(display_class)
if import_stmt:
exec(import_stmt)
else:
#.........这里部分代码省略.........