本文整理汇总了Python中pyasm.web.WebContainer.register_cmd方法的典型用法代码示例。如果您正苦于以下问题:Python WebContainer.register_cmd方法的具体用法?Python WebContainer.register_cmd怎么用?Python WebContainer.register_cmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.WebContainer
的用法示例。
在下文中一共展示了WebContainer.register_cmd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_new_tab_wdg
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import register_cmd [as 别名]
def get_new_tab_wdg(self):
widget = Widget()
span = SpanWdg()
swap = SwapDisplayWdg.get_triangle_wdg()
title = SpanWdg("Tab Creation")
span.add(swap)
span.add(title)
span.add_style("float: left")
widget.add(span)
widget.add(HtmlElement.br() )
# add the tab selector
div = DivWdg()
SwapDisplayWdg.create_swap_title( title, swap, div)
tab_text = TextWdg("tab")
tab_text.set_persistence()
span = SpanWdg(css="med")
span.add("Tab: ")
span.add(tab_text)
div.add(span)
# parent
index_text = TextWdg("parent_tab")
index_text.set_persistence()
span = SpanWdg(css="med")
span.add("Parent Tab: ")
span.add(index_text)
span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") )
div.add(span)
# index
index_text = TextWdg("index")
index_text.set_attr("size", "4")
index_text.set_persistence()
span = SpanWdg(css="med")
span.add("Index: ")
span.add(index_text)
span.add(HintWdg("Enter the numeric location for this tab to be placed") )
div.add(span)
WebContainer.register_cmd("CreateTabCmd")
button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True)
div.add(button)
widget.add(div)
return widget
示例2: get_title
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import register_cmd [as 别名]
def get_title(my):
widget = Widget()
"""
search_key_wdg = HiddenWdg('search_key')
search_key_wdg.get_value()
widget.add(search_key_wdg)
"""
WebContainer.register_cmd("pyasm.flash.widget.RenderCbk")
if not my.get_option("no_button"):
render_button = IconSubmitWdg("Render", IconWdg.RENDER, True, add_hidden=True)
widget.add(render_button)
else:
widget.add("Frame Info")
float_button = IconSubmitWdg("Render", IconWdg.RENDER, add_hidden=False)
span = SpanWdg(float_button, css="med")
span.add_style("border-left", "1px solid #777")
WebContainer.get_float_menu().add(span)
return widget
示例3: init
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import register_cmd [as 别名]
def init(my):
my.item_cls = my.kwargs.get('left_search_type')
my.container_cls = my.kwargs.get('right_search_type')
my.grouping_cls = my.kwargs.get('search_type')
my.item_sobj = my.container_sobj = None
# List the items
search = Search(my.item_cls)
my._order_search(search)
items = search.get_sobjects()
if items:
my.item_sobj = items[0]
#select = MultiSelectWdg("item_ids")
#select.set_search_for_options(search,"login", "get_full_name()")
user_span = SpanWdg(css='med')
user_table = Table(css='table')
user_table.add_style("margin-left: 6px")
user_table.set_max_width()
user_table.add_col(css='small')
user_table.add_col()
user_table.add_style("min-width: 14em")
user_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
for item in items:
user_table.add_row()
checkbox = CheckboxWdg("item_ids")
checkbox.set_option("value", item.get_primary_key_value() )
user_table.add_cell( checkbox )
project_code = item.get_value("project_code", no_exception=True)
if project_code:
user_table.add_cell( "[ %s ]" % project_code )
else:
user_table.add_cell( "[ * ]" )
user_table.add_cell( item.get_description() )
user_span.add(user_table)
# control widget in the middle
control_div = DivWdg()
control_div.add_style('padding: 100px 10px 0 10px')
button = IconSubmitWdg(my.ADD_LABEL, "stock_insert-slide.png", True)
button.add_style('padding: 2px 30px 4px 30px')
control_div.add(button)
main_table = Table(css='collapse')
main_table.set_max_width()
main_table.add_row(css='plain_bg')
main_table.add_cell(user_span, 'valign_top')
td = main_table.add_cell(control_div, 'valign_top')
td.add_style('width','12em')
main_table.add_cell(my._get_target_span(), 'valign_top')
my.add(main_table)
# register command here
if my.item_sobj and my.container_sobj:
marshaller = WebContainer.register_cmd("pyasm.widget.SObjectGroupCmd")
marshaller.set_option("grouping_search_type", my.grouping_cls)
marshaller.set_option("item_foreign_key", my.item_sobj.get_foreign_key())
marshaller.set_option("container_foreign_key", my.container_sobj.get_foreign_key())
示例4: get_display
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import register_cmd [as 别名]
def get_display(my):
web = WebContainer.get_web()
if not my.view:
my.view = web.get_form_value("view")
if not my.view:
my.view = get_template_view()
widget = Widget()
widget.add( HiddenWdg("search_type", my.search_type) )
# get a list of all of the element names possible
search_type_obj = SearchType.get(my.search_type)
config = WidgetConfigView.get_by_search_type(my.search_type,DEFAULT_VIEW)
if config:
element_names = config.get_element_names()
# FIXME: also get those from the default (not sure about this)
config = WidgetConfigView.get_by_search_type(my.search_type,"default")
if config:
element_names.extend( config.get_element_names() )
if not element_names:
element_names = []
# get the custom element names from config
custom_config = WidgetConfigView.get_by_search_type(my.search_type,my.view)
custom_element_names = custom_config.get_element_names()
# get the custom properties
search = Search("prod/custom_property")
search.add_filter("search_type", my.search_type)
custom_properties = search.get_sobjects()
# action popup
action_popup = my.action_popup
action_popup.set_auto_hide(False)
action_popup.set_submit(False)
action_popup.add( HtmlElement.href("Add ...", "javascript:document.form.submit()") )
for custom_property in custom_properties:
element_name = custom_property.get_name()
if element_name not in custom_element_names:
action_popup.add( " %s" % element_name, "add|%s" % element_name )
for element_name in element_names:
if element_name not in custom_element_names:
action_popup.add( " %s" % element_name, "add|%s" % element_name )
# add some standard properties
if my.view in ["edit", "insert"]:
for element_name in PREDEFINED_EDIT_ELEMENTS:
if element_name not in custom_element_names:
action_popup.add( " %s" % element_name, "add|%s" % element_name )
else:
for element_name in PREDEFINED_ELEMENTS:
if element_name not in custom_element_names:
action_popup.add( " %s" % element_name, "add|%s" % element_name )
action_popup.add_separator()
action_popup.add( HtmlElement.href("Remove ...", "javascript:document.form.submit()") )
for element_name in custom_element_names:
action_popup.add( " %s" % element_name, "remove|%s" % element_name )
action_popup.add_separator()
span = SpanWdg("New Custom ...", css="hand")
iframe = WebContainer.get_iframe()
url = WebContainer.get_web().get_widget_url()
url.set_option("widget", "pyasm.widget.CustomAddPropertyWdg")
url.set_option("search_type", my.search_type)
url.set_option("view", my.view)
action = iframe.get_on_script(url.to_string() )
span.add_event("onclick", action)
action_popup.add( span )
WebContainer.register_cmd("pyasm.widget.CustomViewAction")
widget.add(action_popup)
return widget
示例5: get_title
# 需要导入模块: from pyasm.web import WebContainer [as 别名]
# 或者: from pyasm.web.WebContainer import register_cmd [as 别名]
def get_title(self):
WebContainer.register_cmd("pyasm.prod.web.SObjectRenderCbk")
render_button = IconSubmitWdg("Render", IconWdg.RENDER, False)
return render_button