本文整理汇总了Python中pyasm.web.SpanWdg.add_event方法的典型用法代码示例。如果您正苦于以下问题:Python SpanWdg.add_event方法的具体用法?Python SpanWdg.add_event怎么用?Python SpanWdg.add_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.SpanWdg
的用法示例。
在下文中一共展示了SpanWdg.add_event方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_add_tab_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_event [as 别名]
def get_add_tab_wdg(my):
span = SpanWdg(css="hand")
span.add("+Add+")
from web_wdg import EditLinkWdg
link = EditLinkWdg(search_type="sthpw/widget_extend", search_id=-1, text="Create New Tab", config_base="tab_extend", action='CreateTabCmd')
link.set_refresh_mode("page")
span.add(link)
popup = PopupMenuWdg("add_tab");
popup.add("Add New Tab")
span.add(popup)
span.add_event("onclick", "toggle_display('add_tab')")
return span
示例2: get_button_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_event [as 别名]
def get_button_wdg(my, script_name):
func_name = script_name
custom_script = my.get_custom_script(script_name)
script = HtmlElement.script('''
%s = function() {
%s
}
''' % (func_name, custom_script) )
button = SpanWdg()
button.add_class("hand")
button.add(script)
button.add("[%s]" % script_name)
button.add_event("onclick", "%s()" % func_name)
return button
示例3: get_link_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_event [as 别名]
def get_link_wdg(my, section_id, target_id, title, options):
view_link_wdg = SpanWdg(css="hand")
view_link_wdg.add_class("SPT_DTS")
view_link_wdg.add_style("color: #292929")
view_link_wdg.add_event("onmouseover", "this.style.background='#696969'")
view_link_wdg.add_event("onmouseout", "this.style.background='#949494'")
view_link_wdg.add(title)
path = title
options['path'] = "/%s" % title
if not options.get('class_name'):
options['class_name'] = "tactic.ui.panel.ViewPanelWdg"
behavior = {
'type': 'click_up',
'cbfn_action': 'spt.side_bar.display_link_cbk',
'target_id': target_id,
'title': title,
'options': options,
}
view_link_wdg.add_behavior( behavior )
options2 = options.copy()
options2['inline_search'] = "true"
behavior = {
'type': 'click_up',
'modkeys': 'SHIFT',
'cbfn_action': 'spt.side_bar.display_link_cbk',
'is_popup': 'true',
'target_id': path,
'title': title,
'options': options2,
}
view_link_wdg.add_behavior( behavior )
return view_link_wdg
示例4: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_event [as 别名]
def get_display(my):
web = WebContainer.get_web()
widget = DivWdg()
widget.add_class("spt_search_limit_top")
#widget.add_style("border", "solid 1px blue")
widget.add_color("background", "background")
widget.add_color("color", "color")
widget.add_style("padding: 5px")
hidden = HiddenWdg("prefix", my.prefix)
widget.add(hidden)
if not my.search and not my.sobjects:
widget.add("No search or sobjects found")
return widget
# my.count should have been set in alter_search()
# which can be called explicitly thru this instance, my.
if not my.count:
my.count = my.search.get_count(no_exception=True)
# if my.sobjects exist thru inheriting from parent widgets
# or explicitly set, (this is not mandatory though)
if my.sobjects and len(my.sobjects) < my.search_limit:
limit = len(my.sobjects)
elif my.search and my.count < my.search_limit:
# this is only true if the total result of the search is
# less than the limit and so this wdg will not display
limit = my.count
else:
limit = my.search_limit
if not limit:
limit = 50
my.search_limit = limit
if my.refresh:
prev = SpanWdg( IconButtonWdg("Prev", IconWdg.LEFT, False ) )
prev.add_style("margin-left: 8px")
prev.add_style("margin-right: 6px")
prev.add_style("margin-top: -2px")
next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
next.add_style("margin-left: 6px")
prev.add_behavior( {
'type': 'click_up',
'cbjs_action': my.refresh_script
} )
next.add_behavior( {
'type': 'click_up',
'cbjs_action': my.refresh_script
} )
else: # the old code pre 2.5
prev = IconButtonWdg("Prev", IconWdg.LEFT, False )
hidden_name = my.prev_hidden_name
hidden = HiddenWdg(hidden_name,"")
prev.add(hidden)
prev.add_event('onclick'," spt.api.Utility.get_input(document,'%s').value ='Prev';%s"\
%(hidden_name, my.refresh_script))
next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
hidden_name = my.next_hidden_name
hidden = HiddenWdg(hidden_name,"")
next.add(hidden)
next.add_event('onclick',"spt.api.Utility.get_input(document,'%s').value ='Next';%s" \
%(hidden_name, my.refresh_script))
showing_wdg = DivWdg()
widget.add(showing_wdg)
showing_wdg.add_style("padding: 10px")
showing_wdg.add_style("margin: 10px")
showing_wdg.add_color("background", "background", -5)
showing_wdg.add_border()
label_span = SpanWdg("Showing: ")
showing_wdg.add(label_span)
showing_wdg.add( prev )
# this min calculation is used so that if my.sobjects is not set
# above for the calculation of the limit, which will make the last
# set of range numbers too big
left_bound = my.current_offset+1
if not limit:
# prevent error in ItemsNavigatorWdg if a search encounters query error
limit = 50
my.search_limit = limit
right_bound = min(my.current_offset+limit, my.count)
if left_bound > right_bound:
left_bound = 1
current_value = "%d - %d" % (left_bound, right_bound)
if my.style == my.SIMPLE:
showing_wdg.add( current_value )
#.........这里部分代码省略.........
示例5: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_event [as 别名]
#.........这里部分代码省略.........
# draw the proceses
top = DivWdg()
action = DivWdg()
action.add_style("float: right")
top.add(action)
table = Table()
table.add_style("font-size: 11px")
top.add(table)
#if my.max_count:
# percent_width = float(len(processes)) / float(my.max_count+1) * 100
#else:
# percent_width = 100
# we want them more squeezed together when in abbr mode
if my.label_select_value != 'abbr':
percent_width = 100
table.add_style("width: %d%%" % percent_width)
tr = table.add_row()
for process in processes:
completion_wdg = my.get_completion(sobject, process,\
len(processes))
if not completion_wdg:
continue
td = table.add_cell( completion_wdg )
td.add_style('border-width: 0px')
tr = table.add_row(css='underline')
tr.add_color("color", "color")
label_format = my.get_option("label_format")
if not label_format:
label_format = my.label_select_value
tup_list = my._get_labels(processes, label_format, show_sub_pipeline=my.is_ajax())
style = ''
for i, tup in enumerate(tup_list):
name, process = tup
span = SpanWdg()
child_pipeline = process.get_child_pipeline()
if child_pipeline:
title = SpanWdg()
title.add("[%s]" % name)
title.add_style("margin-left: -5px")
swap = SwapDisplayWdg.get_triangle_wdg()
content_id = '%s_%s' %(sobject.get_search_key(), child_pipeline.get_id())
content_id = my.generate_unique_id(content_id)
content = DivWdg(id=content_id)
SwapDisplayWdg.create_swap_title(title, swap, content)
dyn_load = AjaxLoader(display_id=content_id)
args_dict = {'search_type': sobject.get_search_type()}
args_dict['search_id'] = sobject.get_id()
args_dict['pipeline_skey'] = child_pipeline.get_search_key()
dyn_load.set_load_method('_get_child_wdg')
dyn_load.set_load_class('pyasm.widget.ParallelStatusWdg', load_args=args_dict)
dyn_load.add_element_name('cal_sub_task')
on_script = dyn_load.get_on_script(load_once=True)
swap.add_action_script(on_script, "set_display_off('%s')" %content_id)
script = "if ($(%s).getStyle('display')=='none') {%s}" \
%(swap.swap1_id, on_script)
title.add_event('onclick', script)
span.add(swap)
span.add(title)
span.add(HtmlElement.br())
span.add(HtmlElement.br())
span.add(content)
else:
span.add(name)
if my.task_per_process_dict.get(process) == 0:
span.add_class('unused')
if label_format == 'small' or label_format == 'abbr':
span.add_class('smaller')
if not label_format == "none":
table.add_cell(span)
return top