本文整理汇总了Python中pyasm.web.DivWdg.get_unique_event方法的典型用法代码示例。如果您正苦于以下问题:Python DivWdg.get_unique_event方法的具体用法?Python DivWdg.get_unique_event怎么用?Python DivWdg.get_unique_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.DivWdg
的用法示例。
在下文中一共展示了DivWdg.get_unique_event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_action_html
# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import get_unique_event [as 别名]
def get_action_html(my):
search_key = SearchKey.get_by_sobject(my.sobjects[0], use_id=True)
search_type = my.sobjects[0].get_base_search_type()
div = DivWdg(css='centered')
# construct the bvr
element_names = my.element_names[:]
for element_name in my.skipped_element_names:
element_names.remove(element_name)
bvr = {
'type': 'click_up',
'mode': my.mode,
'element_names': element_names,
'search_key': search_key,
'input_prefix': my.input_prefix,
'view': my.view
}
if my.mode == 'insert':
bvr['refresh'] = 'true'
# for adding parent relationship in EditCmd
if my.parent_key:
bvr['parent_key'] = my.parent_key
hidden_div = DivWdg()
hidden_div.add_style("display: none")
div.add(hidden_div)
hidden = TextAreaWdg("__data__")
hidden_div.add(hidden)
hidden.set_value( jsondumps(bvr) )
show_action = my.kwargs.get("show_action")
if show_action in [False, 'false']:
return div
div.add_styles('height: 35px; margin-top: 5px;')
div.add_named_listener('close_EditWdg', '''
var popup = spt.popup.get_popup( $('edit_popup') );
if (popup != null) {
spt.popup.destroy(popup);
}
''')
# custom callbacks
cbjs_cancel = my.kwargs.get('cbjs_cancel')
if not cbjs_cancel:
cbjs_cancel = '''
spt.named_events.fire_event('preclose_edit_popup', {});
spt.named_events.fire_event('close_EditWdg', {})
'''
# custom callbacks
cbjs_insert_path = my.kwargs.get('cbjs_%s_path' % my.mode)
cbjs_insert = None
if cbjs_insert_path:
script_obj = CustomScript.get_by_path(cbjs_insert_path)
if script_obj:
cbjs_insert = script_obj.get_value("script")
# get it inline
if not cbjs_insert:
cbjs_insert = my.kwargs.get('cbjs_%s' % my.mode)
# use a default
if not cbjs_insert:
mode_label = my.mode.capitalize()
cbjs_insert = '''
spt.app_busy.show("%sing items", "");
spt.edit.edit_form_cbk(evt, bvr);
spt.app_busy.hide();
'''%mode_label
save_event = my.kwargs.get('save_event')
if not save_event:
save_event = div.get_unique_event("save")
bvr['save_event'] = save_event
bvr['named_event'] = 'edit_pressed'
bvr['cbjs_action'] = cbjs_insert
ok_btn_label = my.mode.capitalize()
if ok_btn_label == 'Edit':
ok_btn_label = 'Save'
if ok_btn_label == 'Insert':
ok_btn_label = 'Add'
#.........这里部分代码省略.........