本文整理汇总了Python中pyasm.web.SpanWdg.set_id方法的典型用法代码示例。如果您正苦于以下问题:Python SpanWdg.set_id方法的具体用法?Python SpanWdg.set_id怎么用?Python SpanWdg.set_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.SpanWdg
的用法示例。
在下文中一共展示了SpanWdg.set_id方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tool_bar
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_tool_bar(my):
widget = Widget()
trash_div = SpanWdg()
# reset some global variables on load
trash_div.add_behavior({'type':'load', 'cbjs_action':'spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}'})
trash_div.set_id('trash_me')
trash_div.add(IconWdg('Trash', IconWdg.TRASH))
trash_div.add("TRASH!")
trash_div.add_class("hand")
trash_div.add_class("spt_side_bar_trash")
trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
bvr = { "type": "click_up",\
'cbjs_action': "alert('Drag and drop link or folder here to remove it.')"}
trash_div.add_behavior(bvr)
widget.add(trash_div)
save_div = SpanWdg(css='med hand spt_side_bar_trash')
save_div.add(IconWdg('Save Ordering', IconWdg.SAVE))
# FIXME: is_personal???
is_personal = 'false'
bvr = { "type": "click_up",\
'cbjs_action': "spt.side_bar.manage_section_action_cbk({'value':'save'},'%s',%s);" % (my.view, is_personal)}
save_div.add_behavior(bvr)
widget.add(save_div)
return widget
示例2: get_tool_bar
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_tool_bar(self):
widget = Widget()
trash_div = SpanWdg()
trash_div.set_id('trash_me')
trash_div.add(IconWdg('Trash', IconWdg.TRASH))
trash_div.add("TRASH!")
trash_div.add_class("hand")
trash_div.add_class("spt_side_bar_trash")
trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
bvr = { "type": "click_up",\
'cbjs_action': "alert('Drag and drop element name here to remove it.')"}
trash_div.add_behavior(bvr)
widget.add(trash_div)
save_div = SpanWdg(css='med hand spt_side_bar_trash')
save_div.add(IconWdg('Save', IconWdg.SAVE))
bvr = { "type": "click_up",\
'cbjs_action': "spt.custom_project.manage_action_cbk({'value':'save'},'%s');" % self.view}
save_div.add_behavior(bvr)
widget.add(save_div)
return widget
示例3: _get_loading_span
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def _get_loading_span(my):
span = SpanWdg()
span.add_style("display","none")
img = HtmlElement.img('/context/icons/common/loading.gif')
img.add_style("height","10px")
msg_span = SpanWdg('loading')
msg_span.set_class('small')
span.add(msg_span)
span.add(img)
span.set_id(my.img_span_name)
return span
示例4: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_display(self):
ajax = AjaxCmd()
ajax.register_cmd("pyasm.widget.ClipboardAddCbk")
progress = ajax.generate_div()
progress.add_style('display', 'inline')
search_type = self.sobject.get_search_type()
search_id = self.sobject.get_id()
ajax.set_option("search_type", search_type)
ajax.set_option("search_id", search_id)
search_key = self.sobject.get_search_key()
span = SpanWdg()
span.set_id("clipboard_%s" % search_key)
span.add_style("display: none")
checkbox = CheckboxWdg()
checkbox.add_style("vertical-align: top")
checkbox.add_style("width: 7px")
checkbox.add_event("onclick", "%s" % ajax.get_on_script(show_progress=False) )
#checkbox.add_event("onmouseover", "this.style.width=15")
#checkbox.add_event("onmouseout", "this.style.width=7")
# FIXME :DEPRECATED
"""
event = WebContainer.get_event_container()
caller = event.get_event_caller(ClipboardWdg.EVENT_ID)
from file_wdg import ThumbWdg
post_script = [caller]
if self.thumbnail_mode:
post_script.append( ThumbWdg.get_refresh_script(\
self.sobject, self.icon_size, show_progress=False) )
progress.set_post_ajax_script(';'.join(post_script))
if Clipboard.is_selected(self.sobject):
checkbox.set_option("checked", "1")
"""
span.add(checkbox)
span.add(progress)
return span
示例5: get_tool_bar
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_tool_bar(my):
widget = DivWdg()
widget.add_style("width: 250px")
refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
refresh.add_behavior(
{
"type": "click_up",
"cbjs_action": """
var top = bvr.src_el.getParent(".spt_panel");
spt.panel.refresh(top);
""",
}
)
widget.add(refresh)
widget.add(" ")
trash_div = SpanWdg()
# reset some global variables on load
trash_div.add_behavior(
{"type": "load", "cbjs_action": "spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}"}
)
trash_div.set_id("trash_me")
trash_div.add(IconWdg("Trash", IconWdg.TRASH))
trash_div.add_class("hand")
trash_div.add_class("spt_side_bar_trash")
trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
bvr = {"type": "click_up", "cbjs_action": "alert('Drag and drop link or folder here to remove it.')"}
trash_div.add_behavior(bvr)
widget.add(trash_div)
save_div = SpanWdg(css="med hand spt_side_bar_trash")
save_div.add(IconWdg("Save Ordering", IconWdg.SAVE))
bvr = {
"type": "click_up",
"search_type": my.search_type,
"view": my.view,
"cbjs_action": """
if (confirm("Save ordering of this view [" + bvr.view + "] ?") ) {
var top = bvr.src_el.getParent(".spt_view_manager_top");
var list_top = top.getElement(".spt_menu_item_list");
var server = TacticServerStub.get();
server.start({"title": "Updating views"});
var is_personal = false;
spt.app_busy.show("Saving", "Saving view ["+bvr.view+"]");
spt.side_bar.save_view(bvr.search_type, bvr.view, is_personal, list_top);
server.finish();
spt.app_busy.hide();
}
""",
}
save_div.add_behavior(bvr)
widget.add(save_div)
gear = my.get_gear_menu()
gear.add_style("float: right")
widget.add(gear)
return widget
示例6: get_display
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_display(my):
widget = DivWdg(id='new_item_panel')
widget.add_class("new_item_panel")
widget.add_class("spt_new_item_top")
div = DivWdg()
div.add_color("background", "background")
div.add_color("color", "color")
div.add_style("padding", "5px")
div.add_border()
if my.is_personal:
is_personal = 'true'
else:
is_personal = 'false'
if my.type == 'new_folder':
#div.set_attr('spt_view', 'new_folder')
div.add(HtmlElement.b('Create New Folder'))
div.add(HtmlElement.br(2))
"""
# add exisiting views in the div for checking with client's input
# add exiting views:
from panel_wdg import ViewPanelSaveWdg
views = ViewPanelSaveWdg.get_existing_views(my.is_personal)
hidden = HiddenWdg('existing_views', '|'.join(views))
div.add(hidden)
"""
text2 = TextWdg("new_title")
text2.add_class("spt_new_item_title")
span = SpanWdg("Title: ")
span.set_id('create_new_title')
#span.add_style('display: none')
span.add_style('padding-left: 8px')
span.add(text2)
div.add(span)
div.add(HtmlElement.br(2))
div.add_style("width: 350px")
action = '''
var top = bvr.src_el.getParent(".spt_new_item_top");
var name_el = top.getElement(".spt_new_item_name");
var title = bvr.src_el.value;
var name = title.replace(/[\[email protected]#$%^&*()'"]/g, "");
name = name.replace(/ /g, "_");
name = name.toLowerCase();
name_el.value = name;
'''
# change the name based on the title
text2.add_behavior( {
'type': 'change',
'cbjs_action': action
} )
div.add("The name of the folder is a hidden name that is used by other elements to refer to uniquely to this item.<br/><br/>")
text = TextWdg('new_name')
text.add_class("spt_new_item_name")
span = SpanWdg('Name: ')
span.add(text)
div.add(span)
div.add(HtmlElement.br(2))
#script = "spt.side_bar.manage_section_action_cbk({'value':'predefined'},'project_view');"
#link = HtmlElement.js_href(script, data='[ Predefined View ]')
#div3 = DivWdg('Optional: drag existing elements from Project Views or %s into this new folder' %link.get_buffer_display())
#div.add(div3)
#item_div = DivWdg(css='spt_new_item spt_side_bar_content')
#div.add(item_div)
div.add("<hr/>")
#save_div = SpanWdg(css='med hand')
#div.add(save_div)
#save_div.add(IconWdg('Save Folder', IconWdg.SAVE))
save_button = ActionButtonWdg(title='Create', tip='Create a new folder')
div.add(save_button)
bvr = {
"type": "click_up",
"view": my.view,
"is_personal": is_personal == 'true',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_new_item_top");
var name_el = top.getElement(".spt_new_item_name");
var name_value = name_el.value;
if (name_value == "") {
var title_el = top.getElement(".spt_new_item_title");
var title = title_el.value;
var name = spt.convert_to_alpha_numeric(title);
name_el.value = name;
}
if (name_value == "") {
spt.alert("Please fill in a value for name.");
#.........这里部分代码省略.........
示例7: get_simple_definition_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_simple_definition_wdg(self):
detail_wdg = DivWdg()
detail_wdg.add_color("color", "color")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("margin-top: -23px")
detail_wdg.add(title)
if not self.name_string:
title.add('No database column')
return detail_wdg
title.add("Column Definition")
# add a name entry
detail_wdg.add("<br/>")
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style('padding-top: 6px')
input.set_id("config_element_name")
input.add(HtmlElement.b(self.name_string))
detail_wdg.add(input)
hidden = HiddenWdg('column_name', self.name_string)
detail_wdg.add(hidden)
hidden = HiddenWdg('target_search_type', self.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = ['varchar(256)','varchar', 'character', 'text', 'integer', 'float', 'boolean', 'timestamp', 'Other...']
select = SelectWdg('config_data_type', label ='Data Type: ')
#detail_wdg.add(": ")
select.set_option('values', default_data_types )
select.set_value(self.data_type_string)
select.add_behavior({'type': 'change',
'cbjs_action': "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}"})
data_type.add(select)
text = TextWdg('config_data_type_custom')
span = SpanWdg("Other: ", css='med')
span.add(text)
span.set_id('config_data_type_custom')
span.add_style('display','none')
text.set_value(self.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = SpanWdg()
checkbox = CheckboxWdg('config_nullable', label ='Allow null(empty) value: ')
#detail_wdg.add(": ")
nullable.add(checkbox)
if self.nullable_string in ['True', 'true']:
checkbox.set_checked()
detail_wdg.add(nullable)
#constraint = DivWdg()
#detail_wdg.add(constraint)
#constraint.add_style("margin-top: 10px")
#constraint.add("Constraint: ")
#select = SelectWdg("config_constraint")
#constraint.add(select)
#select.set_option("values", "unique|indexed")
#select.add_empty_option("-- None --")
button_div = DivWdg()
button_div.add_style("text-align: center")
button_div.add_behavior( {
'type': 'load',
'cbjs_action': '''
spt.manage_search_type = {};
spt.manage_search_type.change_column_cbk = function(bvr) {
var class_name = 'tactic.ui.panel.AlterSearchTypeCbk';
var options ={
'alter_mode': bvr.alter_mode,
'title': bvr.title
#.........这里部分代码省略.........
示例8: get_new_definition_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_new_definition_wdg(self):
detail_wdg = DivWdg()
detail_wdg.add_style("color: black")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("color: black")
title.add("Column Definition")
title.add_style("margin-top: -22px")
detail_wdg.add(title)
# add a name entry
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style('padding-top: 6px')
input.set_id("config_element_name")
text = TextWdg('column_name')
text.set_value(self.name_string)
input.add(text)
detail_wdg.add(input)
hidden = HiddenWdg('target_search_type', self.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = ['varchar(256)','varchar', 'character', 'text', 'integer', 'float', 'boolean', 'timestamp', 'Other...']
select = SelectWdg('config_data_type', label ='Data Type: ')
#detail_wdg.add(": ")
select.set_option('values', default_data_types )
select.set_value(self.data_type_string)
select.add_behavior({'type': 'change',
'cbjs_action': "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}"})
data_type.add(select)
text = TextWdg('config_data_type_custom')
span = SpanWdg("Other: ", css='med')
span.add(text)
span.set_id('config_data_type_custom')
span.add_style('display','none')
text.set_value(self.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = DivWdg()
checkbox = CheckboxWdg('config_nullable', label ='Allow null(empty) value: ')
nullable.add(checkbox)
if self.nullable_string in ['True', 'true']:
checkbox.set_checked()
detail_wdg.add(nullable)
return detail_wdg
示例9: get_new_definition_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_new_definition_wdg(my):
detail_wdg = DivWdg()
detail_wdg.add_style("color: black")
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("margin-top: 10px")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_border()
title = DivWdg()
title.add_style("color: black")
title.add("Column Definition")
title.add_style("margin-top: -22px")
detail_wdg.add(title)
# add a name entry
title = SpanWdg()
detail_wdg.add("Name: ")
detail_wdg.add(title)
input = SpanWdg()
input.add_style("padding-top: 6px")
input.set_id("config_element_name")
text = TextWdg("column_name")
text.set_value(my.name_string)
input.add(text)
detail_wdg.add(input)
hidden = HiddenWdg("target_search_type", my.search_type)
detail_wdg.add(hidden)
detail_wdg.add(HtmlElement.br(2))
# add data_type entry
data_type = SpanWdg()
default_data_types = [
"varchar(256)",
"varchar",
"character",
"text",
"integer",
"float",
"boolean",
"timestamp",
"Other...",
]
select = SelectWdg("config_data_type", label="Data Type: ")
# detail_wdg.add(": ")
select.set_option("values", default_data_types)
select.set_value(my.data_type_string)
select.add_behavior(
{
"type": "change",
"cbjs_action": "if (bvr.src_el.value=='Other...') {spt.show('config_data_type_custom');}\
else {spt.hide('config_data_type_custom');}",
}
)
data_type.add(select)
text = TextWdg("config_data_type_custom")
span = SpanWdg("Other: ", css="med")
span.add(text)
span.set_id("config_data_type_custom")
span.add_style("display", "none")
text.set_value(my.data_type_string)
data_type.add("<br/>")
data_type.add(span)
detail_wdg.add(data_type)
detail_wdg.add("<br/>")
# add a nullable entry
nullable = DivWdg()
checkbox = CheckboxWdg("config_nullable", label="Allow null(empty) value: ")
nullable.add(checkbox)
if my.nullable_string in ["True", "true"]:
checkbox.set_checked()
detail_wdg.add(nullable)
return detail_wdg
示例10: get_info_wdg
# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import set_id [as 别名]
def get_info_wdg(my):
widget = Widget()
table = Table()
table.set_class("minimal")
table.add_style("font-size: 0.8em")
context_option = my.kwargs.get('context')
context_expr_option = my.kwargs.get('context_expr')
pipeline_option = my.kwargs.get('pipeline') in ['true', True, 'True']
setting_option = my.kwargs.get('setting')
context_name = "%s|context" % my.get_input_name()
text = None
span1 = SpanWdg("Context", id='context_mode')
span2 = SpanWdg("Context<br/>/Subcontext", id='subcontext_mode')
span2.add_style('display','none')
table.add_cell(span1)
table.add_data(span2)
if context_expr_option or context_option or setting_option:
# add swap display for subcontext only if there is setting or context option
swap = SwapDisplayWdg()
table.add_data(SpanWdg(swap, css='small'))
swap.set_display_widgets(StringWdg('[+]'), StringWdg('[-]'))
subcontext_name = "%s|subcontext" % my.get_input_name()
subcontext = SpanWdg('/ ', css='small')
subcontext.add(TextWdg(subcontext_name))
subcontext.add_style('display','none')
subcontext.set_id(subcontext_name)
on_script = "set_display_on('%s');swap_display('subcontext_mode','context_mode')"%subcontext_name
off_script = "set_display_off('%s');get_elements('%s').set_value(''); "\
"swap_display('context_mode','subcontext_mode')"%(subcontext_name, subcontext_name)
swap.add_action_script(on_script, off_script)
text = SelectWdg(context_name)
if my.sobjects:
text.set_sobject(my.sobjects[0])
if context_expr_option:
text.set_option('values_expr', context_expr_option)
elif context_option:
text.set_option('values', context_option)
elif setting_option:
text.set_option('setting', setting_option)
td = table.add_cell(text)
table.add_data(subcontext)
elif pipeline_option:
from pyasm.biz import Pipeline
sobject = my.sobjects[0]
pipeline = Pipeline.get_by_sobject(sobject)
context_names = []
process_names = pipeline.get_process_names(recurse=True)
for process in process_names:
context_names.append(pipeline.get_output_contexts(process))
text = SelectWdg(context_name)
text.set_option('values', process_names)
table.add_cell(text)
else:
text = TextWdg(context_name)
table.add_cell(text)
hint = HintWdg('If not specified, the default is [publish]')
table.add_data(hint)
revision_cb = CheckboxWdg('%s|is_revision' %my.get_input_name(),\
label='is revision', css='med')
table.add_data(revision_cb)
table.add_row()
table.add_cell("Comment")
textarea = TextAreaWdg("%s|description"% my.get_input_name())
table.add_cell(textarea)
widget.add(table)
return widget