本文整理汇总了Python中pyasm.web.Table.add_data方法的典型用法代码示例。如果您正苦于以下问题:Python Table.add_data方法的具体用法?Python Table.add_data怎么用?Python Table.add_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Table
的用法示例。
在下文中一共展示了Table.add_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_data [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
task_table = Table(css="minimal")
task_table.add_style("width: 300px")
search_key = sobject.get_search_key()
tasks = my.tasks_dict.get(search_key)
if tasks:
for task in tasks:
task_table.add_row()
process = task.get_value("process")
td = task_table.add_cell(HtmlElement.i(process))
task_table.add_data(':')
td.add_style("vertical-align: top")
td.add_style("text-align: right")
td.add_style("width: 75px")
td.add_style("padding: 2px")
task_table.add_cell( task.get_value("description") )
return task_table
示例2: get_display
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_data [as 别名]
#.........这里部分代码省略.........
msg = DivWdg("Warning: The widget definition for [%s] uses [%s] and is not meant for use in Edit Layout. Please revise the edit_definition in widget config."% (widget.get_name(), widget.__class__.__name__ ))
msg.add_style('color: orange')
content_div.add(msg)
content_div.add(HtmlElement.br())
continue
if my.input_prefix:
widget.set_input_prefix(my.input_prefix)
if isinstance(widget, HiddenWdg):
content_div.add(widget)
continue
# Set up any validations configured on the widget ...
from tactic.ui.app import ValidationUtil
v_util = ValidationUtil( widget=widget )
v_bvr = v_util.get_validation_bvr()
if v_bvr:
if (isinstance(widget, CalendarInputWdg)):
widget.set_validation( v_bvr.get('cbjs_validation'), v_bvr.get('validation_warning') );
else:
widget.add_behavior( v_bvr )
widget.add_behavior( v_util.get_input_onchange_bvr() )
new_row = i % num_columns == 0
if new_row:
tr = table.add_row()
if my.color_mode == "default":
if i % 2 == 0:
tr.add_color("background", "background")
else:
tr.add_color("background", "background", -5)
show_title = (widget.get_option("show_title") != "false")
if show_title:
title = widget.get_title()
td = table.add_cell(title)
td.add_style("padding: 10px 15px 10px 5px")
td.add_style("vertical-align: top")
title_width = my.kwargs.get("title_width")
if title_width:
td.add_style("width: %s" % title_width)
else:
td.add_style("width: 100px")
security = Environment.get_security()
if security.check_access("builtin", "view_site_admin", "allow"):
SmartMenu.assign_as_local_activator( td, 'HEADER_CTX' )
if my.color_mode == "default":
td.add_color("border-color", "table_border", default="border")
td.add_style("border-width: 1" )
td.add_style("border-style: solid" )
td.add_style("text-align: right" )
if not show_title:
th, td = table.add_row_cell( widget )
#td.add_border()
continue
else:
td = table.add_cell( widget )
#td = table.add_cell( widget.get_value() )
td.add_style("min-width: 300px")
td.add_style("padding: 10px 15px 10px 5px")
td.add_style("vertical-align: top")
if my.color_mode == "default":
td.add_color("border-color", "table_border", default="border")
td.add_style("border-width: 1" )
td.add_style("border-style: solid" )
hint = widget.get_option("hint")
if hint:
table.add_data( HintWdg(hint) )
if not my.is_disabled and not my.mode == 'view':
tr, td = table.add_row_cell( my.get_action_html() )
if my.input_prefix:
prefix = HiddenWdg("input_prefix", my.input_prefix)
tr, td = table.add_row_cell()
td.add(prefix)
top_div.add(content_div)
return top_div
示例3: get_info_wdg
# 需要导入模块: from pyasm.web import Table [as 别名]
# 或者: from pyasm.web.Table import add_data [as 别名]
def get_info_wdg(my):
widget = Widget()
table = Table()
table.set_class("minimal")
table.add_style("font-size: 0.8em")
context_option = my.kwargs.get('context')
context_expr_option = my.kwargs.get('context_expr')
pipeline_option = my.kwargs.get('pipeline') in ['true', True, 'True']
setting_option = my.kwargs.get('setting')
context_name = "%s|context" % my.get_input_name()
text = None
span1 = SpanWdg("Context", id='context_mode')
span2 = SpanWdg("Context<br/>/Subcontext", id='subcontext_mode')
span2.add_style('display','none')
table.add_cell(span1)
table.add_data(span2)
if context_expr_option or context_option or setting_option:
# add swap display for subcontext only if there is setting or context option
swap = SwapDisplayWdg()
table.add_data(SpanWdg(swap, css='small'))
swap.set_display_widgets(StringWdg('[+]'), StringWdg('[-]'))
subcontext_name = "%s|subcontext" % my.get_input_name()
subcontext = SpanWdg('/ ', css='small')
subcontext.add(TextWdg(subcontext_name))
subcontext.add_style('display','none')
subcontext.set_id(subcontext_name)
on_script = "set_display_on('%s');swap_display('subcontext_mode','context_mode')"%subcontext_name
off_script = "set_display_off('%s');get_elements('%s').set_value(''); "\
"swap_display('context_mode','subcontext_mode')"%(subcontext_name, subcontext_name)
swap.add_action_script(on_script, off_script)
text = SelectWdg(context_name)
if my.sobjects:
text.set_sobject(my.sobjects[0])
if context_expr_option:
text.set_option('values_expr', context_expr_option)
elif context_option:
text.set_option('values', context_option)
elif setting_option:
text.set_option('setting', setting_option)
td = table.add_cell(text)
table.add_data(subcontext)
elif pipeline_option:
from pyasm.biz import Pipeline
sobject = my.sobjects[0]
pipeline = Pipeline.get_by_sobject(sobject)
context_names = []
process_names = pipeline.get_process_names(recurse=True)
for process in process_names:
context_names.append(pipeline.get_output_contexts(process))
text = SelectWdg(context_name)
text.set_option('values', process_names)
table.add_cell(text)
else:
text = TextWdg(context_name)
table.add_cell(text)
hint = HintWdg('If not specified, the default is [publish]')
table.add_data(hint)
revision_cb = CheckboxWdg('%s|is_revision' %my.get_input_name(),\
label='is revision', css='med')
table.add_data(revision_cb)
table.add_row()
table.add_cell("Comment")
textarea = TextAreaWdg("%s|description"% my.get_input_name())
table.add_cell(textarea)
widget.add(table)
return widget