本文整理汇总了Python中pyasm.web.DivWdg.add_behavior方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.add_behavior方法的具体用法?Python DivWdg.add_behavior怎么用?Python DivWdg.add_behavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.add_behavior方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_async_element_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_async_element_wdg(my, xml, element_name, load):
tmp_config = WidgetConfig.get("tmp", xml=xml)
display_handler = tmp_config.get_display_handler(element_name)
display_options = tmp_config.get_display_options(element_name)
div = DivWdg()
unique_id = div.set_unique_id()
if load == "sequence":
my.sequence_data.append({"class_name": display_handler, "kwargs": display_options, "unique_id": unique_id})
else:
div.add_behavior(
{
"type": "load",
"class_name": display_handler,
"kwargs": display_options,
"cbjs_action": """
spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
""",
}
)
loading_div = DivWdg()
loading_div.add_style("margin: auto auto")
loading_div.add_style("width: 150px")
loading_div.add_style("text-align: center")
loading_div.add_style("padding: 20px")
div.add(loading_div)
loading_div.add("""<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>""")
return div
示例2: get_search_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_search_wdg(self):
filter_div = DivWdg()
filter_div.add_style("width: 100px")
buttons_list = [
{'label': 'Run Search', 'tip': 'Run search with this criteria' },
]
txt_btn_set = TextBtnSetWdg( position='', buttons=buttons_list, spacing=6, size='large', side_padding=4 )
run_search_bvr = {
'type': 'click_up',
'cbjs_action': '''
spt.app_busy.show('Search ...', 'Searching Active Directory for matching users.');
setTimeout( function() {
var top = bvr.src_el.getParent('.ad_search_wdg_top');
var values = spt.api.Utility.get_input_values(top);
spt.panel.refresh(top, values);
spt.app_busy.hide();
}, 100);
'''
}
txt_btn_set.get_btn_by_label('Run Search').add_behavior( run_search_bvr )
#filter_div.add( txt_btn_set )
div = DivWdg()
div.add_behavior(run_search_bvr)
button = ProdIconButtonWdg("Run Search")
button.add_behavior(run_search_bvr)
div.add(button)
filter_div.add(div)
return filter_div
示例3: get_example_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_example_display(my):
div = DivWdg()
# --- Example of new spt.fx animation slider --------------------------------------------------------------
slide_div = DivWdg()
slide_div.set_id( "ui_play_sliding_thing" )
slide_div.set_style( "background: #9f9f9f; color: #0f0f0f; border: 1px solid black;" )
slide_div.add( "For a moment after Mr. and Mrs. Darling left the house the night-lights by the beds of the three children continued to burn clearly. They were awfully nice little night-lights, and one cannot help wishing that they could have kept awake to see Peter; but Wendy's light blinked and gave such a yawn that the other two yawned also, and before they could close their mouths all the three went out. There was another light in the room now, a thousand times brighter than the night-lights, and in the time we have taken to say this, it had been in all the drawers in the nursery, looking for Peter's shadow, rummaged the wardrobe and turned every pocket inside out. It was not really a light; it made this light by flashing about so quickly, but when it came to rest for a second you saw it was a fairy, no longer than your hand, but still growing. It was a girl called Tinker Bell exquisitely gowned in a skeleton leaf, cut low and square, through which her figure could be seen to the best advantage. She was slightly inclined to embonpoint." )
div.add( slide_div )
div.add( '<br/>' )
click_slide = DivWdg()
click_slide.add( "Click Me to Slide!" )
click_slide.set_style( "background: #0f0f0f; color: #9f9f9f; border: 1px solid black; width: 100px; " \
"cursor: pointer;" )
click_slide.add_behavior( { 'type': 'click_up',
'dst_el': 'ui_play_sliding_thing',
'cbfn_action': 'spt.fx.slide_anim_cbk',
'options': { 'direction': 'vertical',
'duration': 500, # time in milliseconds
'frame_rate': 15 # frames per second
}
} )
div.add( click_slide )
return div
示例4: get_section_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_section_wdg(my, title, description, image, behavior):
section_wdg = DivWdg()
section_wdg.set_round_corners()
section_wdg.add_border()
section_wdg.add_class("spt_report_top")
section_wdg.add_style("width: 200px")
section_wdg.add_style("height: 100px")
section_wdg.add_style("overflow: hidden")
section_wdg.add_style("margin: 10px")
section_wdg.set_box_shadow("0px 0px 10px")
title_wdg = DivWdg()
section_wdg.add(title_wdg)
title_wdg.add(title)
title_wdg.add_style("height: 20px")
title_wdg.add_style("padding: 3px")
title_wdg.add_style("margin-top: 3px")
title_wdg.add_style("font-weight: bold")
title_wdg.add_gradient("background", "background")
button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN)
title_wdg.add(button)
button.add_style("float: right")
# set up menus
menu = my.get_menu()
SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } )
SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True )
section_wdg.add_color("background", "background")
#section_wdg.add_gradient("background", "background", 0, -3)
section_wdg.add_behavior( {
'type': 'hover',
'add_color_modifier': -5,
'cb_set_prefix': 'spt.mouse.table_layout_hover',
} )
desc_div = DivWdg()
desc_div.add(description)
desc_div.add_style("padding: 5px 10px 10px 5px")
div = DivWdg()
section_wdg.add(div)
div.add_style("padding: 3px")
div.add_style("margin: 5px")
div.add_style("width: 65px")
div.add_style("height: 50px")
div.add_style("float: left")
div.add(image)
section_wdg.add(desc_div)
div.add_style("overflow: hidden")
section_wdg.add_behavior( behavior )
section_wdg.add_class("hand")
return section_wdg
示例5: get_ping_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_ping_wdg(self):
div = DivWdg()
div.add_class("spt_diagnostics_ping")
ping_div = DivWdg()
div.add(ping_div)
ping_div.add( CheckboxWdg() )
ping_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
var server = TacticServerStub.get();
var result = server.ping();
var msg = 'wow';
var status_el = spt.get_cousin(bvr.src_el, ".spt_diagnostics_ping",".spt_diagnostics_ping_status");
status_el.innerHTML = result;
'''
} )
# Test database connection
ping_div.add("Test Server Ping")
status_div = DivWdg()
status_div.add_class("spt_diagnostics_ping_status")
status_div.add("Checking ...")
div.add(status_div)
return div
示例6: get_async_element_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_async_element_wdg(my, xml, element_name, load):
tmp_config = WidgetConfig.get('tmp', xml=xml)
display_handler = tmp_config.get_display_handler(element_name)
display_options = tmp_config.get_display_options(element_name)
div = DivWdg()
unique_id = div.set_unique_id()
if load == "sequence":
my.sequence_data.append( {
'class_name': display_handler,
'kwargs': display_options,
'unique_id': unique_id
} )
else:
div.add_behavior( {
'type': 'load',
'class_name': display_handler,
'kwargs': display_options,
'cbjs_action': '''
spt.panel.async_load(bvr.src_el, bvr.class_name, bvr.kwargs);
'''
} )
loading_div = DivWdg()
loading_div.add_style("margin: auto auto")
loading_div.add_style("width: 150px")
loading_div.add_style("text-align: center")
loading_div.add_style("padding: 20px")
div.add(loading_div)
loading_div.add('''<img src="/context/icons/common/indicator_snake.gif" border="0"/> <b>Loading ...</b>''')
return div
示例7: get_menu_item
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_menu_item(my, element_name, display_handler):
content = DivWdg()
content.add_attr("spt_element_name", element_name)
content.add_class("hand")
# add the drag/drop behavior
behavior = {
"type": "drag",
"mouse_btn": "LMB",
"modkeys": "",
"src_el": "@",
"cbfn_setup": "spt.side_bar.pp_setup",
"cbfn_motion": "spt.side_bar.pp_motion",
"cbfn_action": "spt.side_bar.pp_action",
}
content.add_behavior(behavior)
content.set_id("manage_%s" % element_name)
content.add_style("position: relative")
content.add_style("margin: 3px")
content.add_style("left: 0")
content.add_style("top: 0")
content.add_style("z-index: 100")
if display_handler == "SeparatorWdg":
content.add(HtmlElement.hr())
else:
content.add(element_name)
return content
示例8: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_display(my):
dd_activator = DivWdg()
if my.style:
dd_activator.add_styles( my.style )
dd_activator.add_style( "width: %spx" % my.width )
dd_activator.add_class("SPT_DTS");
if my.nudge_menu_horiz != 0:
dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)
if my.nudge_menu_vert != 0:
dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)
# Generate button ...
#
table = Table()
table.add_row()
table.add_styles("width: 100%; padding: 0px; margin: 0px;")
td = table.add_cell()
td.add_looks("menu border curs_default")
td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )
title_div = DivWdg()
title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
if my.icon_path:
img = HtmlElement.img()
img.set_attr("src", my.icon_path)
img.set_attr("title", my.title)
img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
title_div.add(img)
title_div.add_looks("menu")
else:
title_div.add(my.title)
title_div.add_looks("menu fnt_text")
td.add( title_div )
td = table.add_cell()
# -- Example of setting only some of the borders with dotted style ...
# td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
td.add_looks( "menu_btn_icon border curs_default" )
td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
"width: 15px; min-width: 15px;" \
"height: 12px; max-height: 12px;" )
arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
td.add( arrow_img )
dd_activator.add(table)
dd_activator.add( my.kwargs.get("smart_menu_set") )
dd_activator.add_class("SPT_SMENU_ACTIVATOR")
dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )
return dd_activator
示例9: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_display(my):
div = DivWdg()
class_path = Common.get_full_class_name(my)
from tactic.ui.panel import HashPanelWdg
try:
widget = HashPanelWdg.get_widget_from_hash("/index", return_none=True)
div.add(widget)
except:
widget = None
if not widget:
class_path = class_path.replace("IndexWdg", "IndexWdg2")
kwargs = {}
div.add_behavior( {
'type': 'load',
'class_path': class_path,
'kwargs': kwargs,
'cbjs_action': '''
spt.dom.load_js(["popup.js"], function() {
spt.panel.load(bvr.src_el, bvr.class_path, bvr.kwargs);
});
'''
} )
return div
示例10: get_example_chooser_content
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_example_chooser_content(self):
choice_list_div = DivWdg()
choice_list_div.set_id("UiExampleChoiceList")
choice_list_div.add_styles( "background: #202020; color: #999999; border: 1px solid black; " \
"border-top: 0px;" )
example_wdg_classes = self._get_example_widget_classes()
choice_list_div.add( "<br/>" )
for ex_wdg_class in example_wdg_classes:
ex_wdg = ex_wdg_class()
ex_title = ex_wdg.get_example_title()
ex_desc = ex_wdg.get_example_description()
ex_class_path = Common.get_full_class_name( ex_wdg )
ex_div = DivWdg()
ex_div.add_styles( "color: #999999; padding: 8px; padding-left: 20px; cursor: pointer;" )
ex_div.add_class("SPT_DTS")
ex_div.add_behavior( {'type': 'click_up',
'cbjs_action': 'spt.ui_play.show_example("%s");' % ex_class_path } )
ex_div.add( ex_title )
choice_list_div.add( ex_div )
choice_list_div.add( "<br/>" )
return choice_list_div
示例11: get_display
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_display(self):
"""
Get the display for this edit wdg launcher. It should appear as
the name of the sobject, bold and underlined.
:return: the sobject edit launcher widget
"""
search_type = self.kwargs.get('search_type')
sobject_code = self.get_sobject_code()
display_column = self.kwargs.get('display_column')
if not display_column:
display_column = 'code'
display_name = self.server.eval("@GET({0}['code','{1}'].{2})".format(search_type, sobject_code, display_column))
display_name = display_name[0] if display_name else sobject_code
display_mode = self.kwargs.get('display_mode')
if display_mode == 'Browser':
url = ctu.get_edit_wdg_url(search_type, sobject_code, server=self.server)
launch_behavior = self.get_browser_tab_behavior(url)
else:
launch_behavior = self.get_launch_behavior(search_type, sobject_code, display_mode)
display_text = '<b><u>{0}</u></b>'.format(display_name)
div = DivWdg(display_text)
div.add_behavior(launch_behavior)
div.add_styles({'cursor': 'pointer'})
return div
示例12: init
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def init(my):
top = DivWdg()
top.set_id('top_of_application')
msg_div = DivWdg()
msg_div.add_style('text-align: center')
msg_div.add('<img src="/context/icons/common/indicator_snake.gif" border="0"/>')
msg_div.add(" ")
project = Project.get()
title = project.get_value("title")
if not title:
title = "TACTIC"
msg_div.add('''Loading "%s" ....'''% title)
msg_div.add_style("font-size: 1.5em")
msg_div.add_behavior( {
'type': 'load',
'hash': my.hash,
'cbjs_action': '''
if (bvr.hash) {
spt.hash.hash = "/" + bvr.hash;
}
else {
spt.hash.hash = "/index";
}
'''
} )
msg_div.add_style("margin: 200 0 500 0")
top.add(msg_div)
my.add(top)
return
示例13: get_elements_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_elements_wdg(my):
div = DivWdg()
div.add_style("min-width: 200px")
div.add_style("min-height: 500px")
title_wdg = DivWdg()
div.add(title_wdg)
title_wdg.add("Elements")
title_wdg.add_style("padding: 5px")
title_wdg.add_gradient("background", "background", -10)
#element_names = ['Checkin', 'Checkout']
element_names = my.config.get_element_names()
elements_wdg = DivWdg()
div.add(elements_wdg)
elements_wdg.add_style("padding: 5px")
view = 'tab_config_whatever'
hover = div.get_color("background", -10)
for element_name in element_names:
element_div = DivWdg()
elements_wdg.add(element_div)
element_div.add(element_name)
element_div.add_style("padding: 3px")
element_div.add_behavior( {
'type': 'hover',
'hover': hover,
'cbjs_action_over': '''bvr.src_el.setStyle("background", bvr.hover)''',
'cbjs_action_out': '''bvr.src_el.setStyle("background", "")'''
} )
element_div.add_class("hand")
element_div.add_behavior( {
'type': 'click_up',
'view': view,
'element_name': element_name,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_tab_edit_top");
var content = top.getElement(".spt_tab_edit_content");
var class_name = 'tactic.ui.tools.tab_edit_wdg.TabElementDefinitionWdg';
var kwargs = {
view: bvr.view,
element_name: bvr.element_name
};
spt.panel.load(content, class_name, kwargs);
'''
} )
return div
示例14: get_item_div
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_item_div(self, sobject):
''' get the item div the sobject'''
top = DivWdg()
top.add_style("padding: 3px 2px")
top.add_class("spt_drop_item")
top.add_class("SPT_DROP_ITEM")
item_div = DivWdg()
top.add(item_div, "item_div")
item_div.add_style("text-overflow: ellipsis")
item_div.add_style("white-space: nowrap")
item_div.add_style("width: 80%")
item_div.add_attr('title','Click to remove')
item_div.add_style("display", "inline-block")
item_div.add_style("vertical-align", "top")
item_div.add_style("overflow", "hidden")
icon_div = DivWdg()
top.add(icon_div)
icon = IconWdg(icon="BS_REMOVE")
icon_div.add(icon)
icon_div.add_behavior( {
'type': 'click_up',
#'cbjs_action': '''spt.dg_table_action.sobject_drop_remove(evt,bvr)'''
'cbjs_action': '''spt.drop.sobject_drop_remove(evt,bvr)'''
} )
icon.add_style("opacity: 0.3")
icon_div.add_class("hand")
icon_div.add_style("display", "inline-block")
icon_div.add_style("vertical-align", "top")
#icon_div.add_border()
#self.menu.set_over(item_div, event="mousein")
#self.menu.set_out(top, event="mouseleave")
# set this as the place for the display value to go
item_div.add_class("spt_drop_display_value")
add_icon = True
ExpressionParser.clear_cache()
if sobject:
if add_icon:
self._add_icon(sobject, item_div)
if self.display_expr:
display_value = Search.eval(self.display_expr, sobjects = sobject, single=True)
else:
display_value = sobject.get_display_value()
if isinstance(display_value, list):
display_value = display_value[0]
item_div.add( display_value )
self.values.append( SearchKey.get_by_sobject(sobject) )
return top
示例15: get_filter_wdg
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import add_behavior [as 别名]
def get_filter_wdg(self, filter_name):
if not filter_name:
filter_name = self.get_name()
from pyasm.web import DivWdg
from tactic.ui.widget import IconButtonWdg
filter_wdg = DivWdg()
button = IconButtonWdg(title="Show Filter", icon="BS_SEARCH")
filter_wdg.add_class("spt_filter_button")
filter_wdg.add(button)
filter_wdg.add_style("display: inline-block")
filter_wdg.add_style("vertical-align: middle")
filter_wdg.add_style("opacity: 0.5")
filter_wdg.add_attr("spt_filter_name", filter_name)
filter_wdg.add_behavior( {
'type': 'click',
'cbjs_action': '''
var panel = bvr.src_el.getParent(".spt_view_panel_top");
var th = bvr.src_el.getParent("th");
var pos = th.getPosition(panel);
var name = bvr.src_el.getAttribute("spt_filter_name");
if (! spt.simple_search.has_element(name) ) {
return;
}
pos.y += 35;
spt.simple_search.show_elements([name]);
spt.simple_search.set_position(pos);
spt.simple_search.hide_title();
spt.simple_search.show();
var top = spt.simple_search.get_top();
var size = top.getSize();
var cur_pos = top.getPosition( $(document.body) );
var window_size = $(document.body).getSize();
if (cur_pos.x + size.x > window_size.x) {
var panel_size = panel.getSize();
pos.x = panel_size.x - size.x;
spt.simple_search.set_position(pos);
}
'''
} )
return filter_wdg