本文整理汇总了Python中pyasm.widget.SelectWdg类的典型用法代码示例。如果您正苦于以下问题:Python SelectWdg类的具体用法?Python SelectWdg怎么用?Python SelectWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SelectWdg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_sync_mode_wdg
def get_sync_mode_wdg(self):
div = DivWdg()
div.add_class("spt_sync_mode")
div.add("Share Mode: ")
select = SelectWdg("sync_mode")
div.add(select)
select.set_option("values", "file|xmlrpc")
select.add_behavior( {
'type': 'change',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_sync_mode");
var value = bvr.src_el.value;
var xmlrpc_el = top.getElement(".spt_xmlrpc_mode");
var file_el = top.getElement(".spt_file_mode");
if (value == 'xmlrpc') {
spt.show(xmlrpc_el);
spt.hide(file_el);
}
else {
spt.hide(xmlrpc_el);
spt.show(file_el);
}
'''
} )
div.add( self.get_xmlrpc_mode_wdg() )
div.add( self.get_file_mode_wdg() )
return div
示例2: get_display
def get_display(my):
widget = DivWdg(id='link_view_select')
widget.add_class("link_view_select")
if my.refresh:
widget = Widget()
else:
my.set_as_panel(widget)
views = []
if my.search_type:
from pyasm.search import WidgetDbConfig
search = Search( WidgetDbConfig.SEARCH_TYPE )
search.add_filter("search_type", my.search_type)
search.add_regex_filter("view", "link_search:|saved_search:", op="NEQI")
search.add_order_by('view')
widget_dbs = search.get_sobjects()
views = SObject.get_values(widget_dbs, 'view')
labels = [view for view in views]
views.insert(0, 'table')
labels.insert(0, 'table (Default)')
st_select = SelectWdg('new_link_view', label='View: ')
st_select.set_option('values', views)
st_select.set_option('labels', labels)
widget.add(st_select)
return widget
示例3: get_display
def get_display(self):
outer_div = DivWdg()
outer_div.set_id('new-department-request-entry-form')
page_label = "<div>Fill out the following form to submit a new request. The request will be added to the " \
"department's list, and will be addressed as soon as possible. You will receive a " \
"notification when the request is complete.</div><br/>"
outer_div.add(page_label)
outer_div.add(get_label_widget('Name'))
outer_div.add(get_text_input_wdg('name', 800))
outer_div.add(get_label_widget('Description'))
outer_div.add(obu.get_text_area_input_wdg('description', 800, [('display', 'block')]))
outer_div.add(get_label_widget('Due Date'))
outer_div.add(get_datetime_calendar_wdg())
department_select_wdg = SelectWdg('department_select')
department_select_wdg.append_option('Onboarding', 'onboarding')
department_select_wdg.append_option('Edel', 'edel')
department_select_wdg.append_option('Compression', 'compression')
department_select_wdg.append_option('QC', 'qc')
outer_div.add(get_label_widget('Department'))
outer_div.add(department_select_wdg)
self.get_submit_widget(outer_div)
return outer_div
示例4: get_display
def get_display(self):
div_wdg = DivWdg()
current_code_div = DivWdg()
component_code = self.file_flow_sobject.get('component_code')
component_sobject = get_sobject_by_code('twog/component', component_code)
current_code_div.add('Current Component set to {0} ({1})'.format(component_sobject.get('name'),
component_code))
order_sobject = get_order_sobject_from_component_sobject(component_sobject)
component_sobjects_for_order = get_component_sobjects_from_order_code(order_sobject.get_code())
component_select_wdg = SelectWdg()
component_select_wdg.set_id('component_select')
component_select_wdg.add_style('width: 165px;')
component_select_wdg.add_empty_option()
for component in component_sobjects_for_order:
component_select_wdg.append_option(component.get('name'), component.get_code())
div_wdg.add(current_code_div)
div_wdg.add(component_select_wdg)
return div_wdg
示例5: get_display
def get_display(my):
widget = Widget()
div = DivWdg(css="filter_box")
show_span = SpanWdg(css="med")
show_span.add("Show All Types: ")
checkbox = FilterCheckboxWdg("show_all_types")
checkbox.set_persistence()
show_span.add(checkbox)
show_all_types = checkbox.get_value()
div.add(show_span)
span = SpanWdg(css="med")
span.add("Search Type: ")
select = SelectWdg("filter|search_type")
select.add_empty_option("-- Select --")
project = Project.get()
project_type = project.get_base_type()
search = Search("sthpw/search_object")
if show_all_types:
search.add_where(
"""
namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task')
"""
% (project_type, project.get_code())
)
else:
# show only the custom ones
search.add_filter("namespace", project.get_code())
search.add_order_by("title")
sobjects = search.get_sobjects()
select.set_sobjects_for_options(sobjects, "search_type", "title")
# select.set_option("query", "sthpw/search_object|search_type|title")
select.set_persistence()
select.add_event("onchange", "document.form.submit()")
search_type = select.get_value()
span.add(select)
div.add(span)
# make sure the current selection exists
try:
SearchType.get(search_type)
except SearchException, e:
return div
示例6: get_file_in_package_status_select
def get_file_in_package_status_select():
task_status_select = SelectWdg('file_status_select')
task_status_select.set_id('file_status_select')
task_status_select.add_style('width: 165px;')
task_status_select.add_empty_option()
pipeline = Pipeline.get_by_code('twog_Delivery')
for status in pipeline.get_process_names():
task_status_select.append_option(status, status)
return task_status_select
示例7: get_title_select_wdg
def get_title_select_wdg(width=300):
title_select_wdg = SelectWdg('title_code')
title_select_wdg.set_id('title_code')
title_select_wdg.add_style('width', '{0}px'.format(width))
title_select_wdg.add_empty_option()
title_search = Search('twog/title')
titles = title_search.get_sobjects()
for title in titles:
title_select_wdg.append_option(title.get_value('name'), title.get_code())
return title_select_wdg
示例8: get_display
def get_display(my):
return ''
search_types = 'MMS/discipline.MMS/product_type'.split(".")
top = DivWdg()
parents = None
for search_type in search_types:
if not parents:
search = Search(search_type)
sobjects = search.get_sobjects()
columns = search.get_columns()
column = columns[1]
select = SelectWdg(search_type)
select.set_option("values", [x.get_id() for x in sobjects] )
select.set_option("labels", [x.get_value(column) for x in sobjects] )
top.add(select)
else:
for parent in parents:
search = Search(search_type)
search.add_relationship_filter(parent)
sobjects = search.get_sobjects()
if not sobjects:
continue
columns = search.get_columns()
column = columns[1]
values = [x.get_id() for x in sobjects]
labels = [x.get_value(column) for x in sobjects]
select = SelectWdg(search_type)
select.add_attr("spt_input_key", parent.get_id() )
select.set_option("values", values )
select.set_option("labels", labels )
top.add(select)
parents = sobjects
return top
示例9: get_security_wdg
def get_security_wdg(self):
div = DivWdg()
div.add_class("spt_security")
div.add("A server can sync either be scoped for a single project or all projects. Transactions that occur in the admin project never get synced.")
div.add("<br/>"*2)
div.add("Project: ")
search = Search("sthpw/project")
search.add_filters("code", ['admin','unittest'], op='not in')
search.add_order_by("title")
projects = search.get_sobjects()
select = SelectWdg("projects")
div.add(select)
labels = [x.get_value("title") for x in projects]
values = [x.get_value("code") for x in projects]
project_code = Project.get_project_code()
if project_code != 'admin':
select.set_value(project_code)
select.set_option("labels", labels)
select.set_option("values", values)
select.add_empty_option("-- All --")
div.add("<br/>"*2)
return div
示例10: get_assigned_select
def get_assigned_select(my, assigned):
# Make the select element for workers
workers_expr = "@GET(sthpw/login['location','internal']['license_type','user'].login)"
workers = my.server.eval(workers_expr)
work_sel = SelectWdg('task_assigned_select')
if len(workers) > 0:
work_sel.append_option('--Select--', '')
if assigned:
work_sel.set_value(assigned)
else:
work_sel.set_value('')
for worker in workers:
work_sel.append_option(worker, worker)
return work_sel
示例11: get_assigned_group_select
def get_assigned_group_select(my, assigned, name):
# Make the select element for groups
groups_expr = "@GET(sthpw/login_group['login_group','not in','user|client|compression supervisor|edit supervisor|machine room supervisor|media vault supervisor|qc supervisor|sales supervisor|scheduling supervisor|streamz|executives|admin|management|office employees|it'].login_group)"
groups = my.server.eval(groups_expr)
group_sel = SelectWdg(name)
if len(groups) > 0:
group_sel.append_option('--Select--', '')
if assigned:
group_sel.set_value(assigned)
else:
group_sel.set_value('')
for group in groups:
group_sel.append_option(group, group)
return group_sel
示例12: get_display
def get_display(my):
sobject = my.get_current_sobject()
key = sobject.get_value("key")
options = sobject.get_value("options")
type = sobject.get_value("type")
# get the value of the users preferences
search = Search("sthpw/pref_setting")
search.add_user_filter()
search.add_filter("key", key)
pref_setting = search.get_sobject()
if pref_setting:
value = pref_setting.get_value("value")
else:
value = ""
div = DivWdg()
element_name = "%s_%s" % (my.get_name(), sobject.get_id() )
script = '''var server = TacticServerStub.get();
var value = bvr.src_el.value;
if (!value) return;
spt.app_busy.show("Saving", "Saving Preference for [%s]");
setTimeout( function() {
try{
server.execute_cmd('tactic.ui.table.SetPreferenceCmd', {key: '%s', value: value});
}catch(e){
spt.alert(spt.exception.handler(e));
}
spt.app_busy.hide()
}, 200);'''%(key, key)
if key in ['skin', 'palette', 'js_logging_level']:
script = '''%s; spt.app_busy.show('Reloading Page ...'); setTimeout('spt.refresh_page()', 200);'''%script
if type == "sequence":
from pyasm.prod.web import SelectWdg
select = SelectWdg(element_name)
select.add_behavior({'type': "change",
'cbjs_action': script})
select.set_option("values",options)
if value:
select.set_value(value)
div.add(select)
else:
text = TextWdg(element_name)
text.add_behavior({'type': "blur",
'cbjs_action': script})
if value:
text.set_value(value)
div.add(text)
return div
示例13: get_language_select_wdg
def get_language_select_wdg():
language_select_wdg = SelectWdg('language_code')
language_select_wdg.set_id('language_code')
language_select_wdg.add_style('display', 'inline-block')
language_select_wdg.add_empty_option()
language_search = Search('twog/language')
languages = language_search.get_sobjects()
languages = sorted(languages, key=lambda x: x.get_value('name'))
for language in languages:
language_select_wdg.append_option(language.get_value('name'), language.get_code())
return language_select_wdg
示例14: get_sel
def get_sel(my, id_name, arr, default, alpha_sort):
this_sel = SelectWdg(id_name)
this_sel.add_attr('id',id_name)
if default not in arr and default not in [None,'']:
arr.append(default)
if alpha_sort:
arr.sort()
arr2 = []
for a in arr:
arr2.append(a)
this_sel.append_option('--Select--','')
for a in arr2:
this_sel.append_option(a,a)
this_sel.set_value(default)
return this_sel
示例15: get_select_wdg
def get_select_wdg(name, options, saved_value=None):
select_wdg = SelectWdg(name)
select_wdg.set_id(name)
select_wdg.add_empty_option()
for option_set in options:
label = option_set[0]
value = option_set[1]
select_wdg.append_option(label, value)
if saved_value:
select_wdg.set_value(saved_value)
return select_wdg