本文整理汇总了Python中pyasm.web.SpanWdg.add方法的典型用法代码示例。如果您正苦于以下问题:Python SpanWdg.add方法的具体用法?Python SpanWdg.add怎么用?Python SpanWdg.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.SpanWdg
的用法示例。
在下文中一共展示了SpanWdg.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_display(my):
widget = Widget()
if not my.select:
return widget
if not my.schema:
Environment.add_warning("No schema defined")
widget.add("No schema defined")
return widget
if not my.search_type:
Environment.add_warning("HierarchicalFilterWdg: Cannot find current search_type")
widget.add("Cannot find current search_type")
return widget
span = SpanWdg(css="med")
parent_type = my.get_parent_type()
if parent_type:
parent_type_obj = SearchType.get(parent_type)
span.add("%s: " % parent_type_obj.get_value("title"))
# assume that there is a code in the parent
my.select.add_empty_option("-- Select --")
my.select.set_option("query", "%s|code|code" % my.parent_type)
span.add(my.select)
widget.add(span)
return widget
示例2: get_prefs
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_prefs(my):
div = DivWdg('Bar Size: ')
my.bar_select = FilterSelectWdg('progress_bar_size')
bar_sizes = [x*2 + 1 for x in xrange(6)]
my.bar_select.set_option('values', bar_sizes)
my.bar_select.set_option('default', '3')
div.add(my.bar_select)
my.bar_select_value = my.bar_select.get_value()
my.label_select = FilterSelectWdg('Label_Format')
my.label_select_value = my.label_select.get_value()
my.label_select.set_option('values', 'reg|small|abbr')
my.label_select.set_option('default', 'reg')
span = SpanWdg('Label Format: ', css='small')
span.add(my.label_select)
div.add(span)
my.desc_checkbox = FilterCheckboxWdg("Show Description", \
'Show Description: ', css='small')
my.desc_checkbox_value = my.desc_checkbox.get_value()
div.add(my.desc_checkbox)
my.include_sub_task = FilterCheckboxWdg("include_sub_task", \
label="include sub tasks", css='small')
my.include_sub_task_value = my.include_sub_task.is_checked()
div.add(my.include_sub_task)
return div
示例3: get_instantiation_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_instantiation_wdg(self):
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
div = DivWdg()
is_unchecked = True
default_cb = None
for value in self.get_instantiation_options():
name = self.get_element_name("instantiation")
checkbox = CheckboxWdg( name )
if value == default_instantiation:
default_cb = checkbox
checkbox.set_option("value", value)
checkbox.set_persistence()
if checkbox.is_checked():
is_unchecked = False
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
span = SpanWdg(checkbox, css='small')
span.add(value)
div.add(span)
if is_unchecked:
default_cb.set_checked()
return div
示例4: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_display(my):
#my.init()
item_table = Table(css='minimal')
item_table.add_style('margin-left','30px')
for item in my.items:
item_table.add_row()
space_td = item_table.add_blank_cell()
item_td = item_table.add_cell(item.get_description())
item_td.set_attr("nowrap", "1")
delete = IconSubmitWdg("Remove from group", \
"stock_stop-16.png",add_hidden=False)
delete.add_event("onclick","document.form.remove_cmd.value=\
'%s|%s';document.form.submit();" \
% (my.group.get_primary_key_value(), item.get_primary_key_value()) )
del_span = SpanWdg(css='med')
del_span.add(delete)
item_table.add_cell(del_span)
if not my.items:
item_table.add_blank_cell()
my.add(item_table)
return super(ItemInContainerWdg, my).get_display()
示例5: add_file_behaviors
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def add_file_behaviors(my, item_div, dirname, basename):
item_div.add_class("spt_script_item")
if not dirname:
path = "///%s" % (basename)
else:
path = "%s/%s" % (dirname, basename)
scripts = my.kwargs.get("scripts")
script = scripts.get(path)
if not script:
item_div.add_style("background-color", "red")
item_div.add_behavior({"type": "click_up",
"cbjs_action" : '''spt.alert("Please remove leading / in this script path's Title attribute by using the Manage button.")'''})
item_div.add_attr("title", "Please remove special characters like / in this script path")
return
script_code = script.get("code")
language = script.get("language")
item_div.add_attr("spt_script_code", script_code)
item_div.add_style("background", "transparent")
if language:
span = SpanWdg()
span.add_style("font-size: 9px")
span.add_style("opacity: 0.2")
span.add(" <i>(%s)</i>" % language)
item_div.add(span)
示例6: get_frame_rate_section
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_frame_rate_section(self):
section_span = SpanWdg()
section_span.add('Frame Rate: ')
frame_rate_select = SelectWdg('frame_rate_select')
frame_rate_select.set_id('frame_rate_code')
frame_rate_select.add_style('width', '153px')
frame_rate_select.add_style('display', 'inline-block')
frame_rate_select.add_empty_option()
frame_rate_search = Search('twog/frame_rate')
frame_rates = frame_rate_search.get_sobjects()
for frame_rate in frame_rates:
frame_rate_select.append_option(frame_rate.get_value('name'), frame_rate.get_code())
try:
frame_rate_select.set_value(self.frame_rate_code)
except AttributeError:
pass
section_span.add(frame_rate_select)
return section_span
示例7: get_license_info_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_license_info_wdg(self):
div = DivWdg()
license = Environment.get_security().get_license()
if self.first_error:
return div
#if not license.is_licensed():
# return div
msg = DivWdg()
div.add(msg)
msg.add("The following describes the details of the installed license:<br/><br/>")
info_wdg = DivWdg()
div.add(info_wdg)
info_wdg.add_style("margin: 10px 30px")
info_wdg.add_style("font-size: 12px")
version = license.get_data("tactic_version")
if version:
info_wdg.add("TACTIC Version: ")
if version == "ALL":
version = "ALL (Open Source)"
info_wdg.add(version)
info_wdg.add(HtmlElement.br(2))
company = license.get_data("company")
info_wdg.add("Licensed To: ")
if company.find("Southpaw EPL") != -1:
company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> ")
icon = IconWdg("EPL v1.0", IconWdg.ZOOM)
company.add(icon)
company.add_class("hand")
company.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.load_alias("license")
'''
} )
info_wdg.add(company)
info_wdg.add(HtmlElement.br(2))
info_wdg.add("Max Users: ")
info_wdg.add(license.get_data("max_users") )
info_wdg.add(HtmlElement.br(2))
info_wdg.add("Current Users: ")
info_wdg.add(license.get_current_users() )
info_wdg.add(HtmlElement.br(2))
info_wdg.add("Expiry Date: ")
expiry_date = license.get_data("expiry_date")
if not expiry_date:
expiry_date = "Permanent"
info_wdg.add(expiry_date)
info_wdg.add(HtmlElement.br(2))
return div
示例8: get_format_section
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_format_section(self):
section_span = SpanWdg()
section_span.add('Format: ')
section_span.add(self.get_format_select_wdg())
return section_span
示例9: get_related_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_related_wdg(my, aliases):
div = DivWdg()
div.add("<b>Related links</b>:  ")
div.add_style("margin-top: 5px")
div.add_style("margin-bottom: 5px")
div.add_style("margin-left: 10px")
titles = [Common.get_display_title(x.replace("-"," ")) for x in aliases]
for alias, title in zip(aliases, titles):
link_div = SpanWdg()
div.add(link_div)
link_div.add_color("background", "background")
link_div.add(title)
link_div.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
spt.help.set_top();
spt.help.load_alias("%s");
''' % alias
} )
link_div.add_class("spt_link")
link_div.add_class("hand")
return div
示例10: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_display(my):
div = SpanWdg()
div.add(" is ")
text = TextWdg("year")
value = my.values.get("year")
if value:
text.set_value(value)
div.add(text)
return div
示例11: get_input_widget_with_label
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_input_widget_with_label(self, label, id, width):
section_span = SpanWdg()
section_span.add_style('display', 'inline-block')
section_span.add(label)
section_span.add(get_text_input_wdg(id, get_attribute_or_none(self, id), width))
return section_span
示例12: _get_target_span
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def _get_target_span(my):
# get the target span
search = Search(my.container_cls)
my._order_search(search)
groups = search.get_sobjects()
if groups:
my.container_sobj = groups[0]
target_span = SpanWdg(css='med')
group_table = Table(my.GROUP_TABLE_NAME, css='table')
group_table.add_style('width','30em')
group_table.add_col(css='small')
group_table.add_col(css='small')
group_table.add_col()
target_span.add(group_table)
group_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
checkbox = CheckboxWdg()
checkbox.set_option("onclick", \
"a=new Elements('container_ids');a.toggle_all(this);")
group_table.add_row()
group_table.add_cell(checkbox)
col_name = group_table.get_next_col_name()
toggle_control = HiddenRowToggleWdg(col_name=col_name, is_control=True, auto_index=True)
group_table.add_cell(toggle_control)
group_table.add_cell('MASTER CONTROL')
remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
my.add(remove_cmd)
for group in groups:
group_table.add_row()
checkbox = CheckboxWdg("container_ids")
checkbox.set_option("value", group.get_primary_key_value() )
toggle = HiddenRowToggleWdg(col_name, auto_index=True)
toggle.store_event()
group_details = ItemInContainerWdg( group, my.item_sobj, my.item_cls, my.grouping_cls )
# set the target content of the toggle
toggle.set_static_content(group_details)
group_table.add_cell( checkbox )
group_table.add_cell( toggle, add_hidden_wdg=True )
group_table.add_cell( group.get_description())
num_items = group_details.get_num_items()
if num_items:
td = group_table.add_cell( "( %s )" % num_items, 'no_wrap')
td.add_color(color)
else:
group_table.add_blank_cell()
return target_span
示例13: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_display(my):
web = WebContainer.get_web()
if not my.view:
view = web.get_form_value("filter|view")
# create popup
create_popup = PopupWdg("create_action")
create_popup.set_auto_hide(False)
create_popup.add("Enter name of view: ")
create_popup.add(TextWdg("create_view_name"))
# create_popup.add( HtmlElement.br(2) )
# create_popup.add( "Copy from template: " )
# template_select = SelectWdg("copy_from_template")
# template_select.add_empty_option("-- None --")
# template_select.set_option("values", "list|summary|task")
# create_popup.add( template_select )
create_popup.add(HtmlElement.br(2, clear="all"))
from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg
create_icon = ProdIconButtonWdg("Create")
ajax = AjaxCmd()
ajax.register_cmd("pyasm.widget.CustomCreateViewCbk")
ajax.add_element_name("create_view_name")
ajax.add_element_name("auto_create_edit")
ajax.set_option("search_type", my.search_type)
ajax.set_option("project", Project.get_project_code())
if my.view:
ajax.set_option("template_view", my.view)
create_icon.add_event(
"onclick",
"%s;%s"
% (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)"),
)
cancel_icon = ProdIconButtonWdg("Cancel")
cancel_icon.add_event("onclick", "toggle_display('create_action')")
span = SpanWdg()
span.add(create_icon)
span.add(cancel_icon)
create_popup.add(span)
create_popup.add(HtmlElement.br())
# add the create button
create = IconButtonWdg("Create View", IconWdg.SAVE, True)
create.add_event("onclick", "%s" % create_popup.get_on_script())
# lay it all out
widget = Widget()
widget.add(create_popup)
# Browser does not have create
# widget.add(create)
return widget
示例14: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_display(my):
span = SpanWdg()
if len(my.text) > my.length:
content = my.text[0:my.length]
span.add('%s...' %content)
span.add_tip(my.text, my.text)
else:
span.add(my.text)
return span
示例15: get_add_multiple_rows_button
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add [as 别名]
def get_add_multiple_rows_button(self):
span_wdg = SpanWdg()
add_rows_button = ButtonNewWdg(title='Add Multiple Row', icon='PLUS_ADD')
add_rows_button.add_class('add_rows_button')
add_rows_button.add_style('display', 'inline-block')
add_rows_button.add_behavior(self.get_add_multiple_rows_behavior())
span_wdg.add(add_rows_button)
return span_wdg