本文整理汇总了Python中pyasm.widget.SelectWdg.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python SelectWdg.set_value方法的具体用法?Python SelectWdg.set_value怎么用?Python SelectWdg.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.SelectWdg
的用法示例。
在下文中一共展示了SelectWdg.set_value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_frame_rate_section
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [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
示例2: get_task_status_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_task_status_select_wdg(task_sobject):
"""
Given a sthpw/task sobject, return a SelectWdg with all its potential status options. This is done by looking up
what those options are through the parent Pipeline.
:param task_sobject: sthpw/task sobject
:return: SelectWdg
"""
task_status_select = SelectWdg('task_status_select')
task_status_select.set_id('task_status_select')
task_status_select.add_style('width: 165px;')
task_status_select.add_empty_option()
task_pipe_code = task_sobject.get_value('pipeline_code')
# if the current task has no pipeline, then search for
# any task pipeline
if not task_pipe_code:
# just use the default
task_pipe_code = 'task'
pipeline = Pipeline.get_by_code(task_pipe_code)
if not pipeline:
pipeline = Pipeline.get_by_code('task')
for status in pipeline.get_process_names():
task_status_select.append_option(status, status)
if task_sobject.get('status'):
task_status_select.set_value(task_sobject.get('status'))
return task_status_select
示例3: get_security_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例4: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_display(my):
widget = DivWdg()
table = Table()
table.add_attr('class','my_preferences_wdg')
prefs = my.login_obj.get('twog_preferences').split(',')
for pref in prefs:
if pref not in [None,'']:
kv = pref.split('=')
key = kv[0]
val = kv[1]
table.add_row()
desc = table.add_cell(my.key_dict[key])
desc.add_attr('nowrap','nowrap')
this_sel = SelectWdg(key)
this_sel.add_attr('id',key)
this_sel.add_style('width: 100px;')
this_sel.append_option('True','true')
this_sel.append_option('False','false')
this_sel.set_value(val)
table.add_cell(this_sel)
table.add_row()
t2 = Table()
t2.add_row()
t2.add_cell()
tc = t2.add_cell('<input type="button" name="Save My Preferences" value="Save My Preferences"/>')
tc.add_attr('width', '50px')
tc.add_behavior(my.get_save_preferences())
t2.add_cell()
table.add_cell(t2)
widget.add(table)
return widget
示例5: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例6: configure_category
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def configure_category(my, title, category, options, options_type = {}):
div = DivWdg()
title_wdg = DivWdg()
div.add(title_wdg)
#from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
#swap = SwapDisplayWdg()
#div.add(swap)
title_wdg.add("<b>%s</b>" % title)
table = Table()
div.add(table)
#table.add_color("color", "color")
table.add_style("color: #000")
table.add_style("margin: 20px")
for option in options:
table.add_row()
display_title = Common.get_display_title(option)
td = table.add_cell("%s: " % display_title)
td.add_style("width: 150px")
option_type = options_type.get(option)
validation_scheme = ""
#add selectWdg for those options whose type is bool
if option_type == 'bool':
text = SelectWdg(name="%s/%s" % (category, option))
text.set_option('values','true|false')
text.set_option('empty','true')
text.add_style("margin-left: 0px")
elif option.endswith('password'):
text = PasswordInputWdg(name="%s/%s" % (category, option))
# dealing with options whose type is number
else:
if option_type == 'number':
validation_scheme = 'INTEGER'
else:
validation_scheme = ""
text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
value = Config.get_value(category, option)
if value:
text.set_value(value)
table.add_cell(text)
return div
示例7: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_display(my):
widget = DivWdg()
pipeline_code = my.get_option('pipeline')
pipeline = Pipeline.get_by_code(pipeline_code)
if not pipeline:
widget.add("No pipeline defined")
return widget
processes = pipeline.get_process_names()
widget.add_style("border: solid 1px blue")
widget.add_style("position: absolute")
widget.add_style("top: 300")
widget.add_style("left: -500")
for process in processes:
#inputs = pipeline.get_input_processes(process)
outputs = pipeline.get_output_processes(process)
div = DivWdg()
widget.add(div)
div.add_class("spt_input_option")
div.add_attr("spt_input_key", process)
#if not outputs:
# # then we can't go anywhere, so just add a message
# text = ""
# div.add(text)
# continue
values = []
#values.extend( [str(x) for x in inputs] )
values.append(process)
values.extend( [str(x) for x in outputs] )
select = SelectWdg(my.get_input_name())
select.set_value(process)
select.add_empty_option('-- Select --')
select.set_option("values", values)
div.add(select)
from tactic.ui.panel import CellEditWdg
CellEditWdg.add_edit_behavior(select)
return widget
示例8: get_assigned_group_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例9: get_assigned_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例10: get_bay_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_bay_select(self):
bay_sel = SelectWdg('bay_select')
bay_sel.set_id('bay')
bay_sel.add_style('width', '135px')
bay_sel.add_empty_option()
for i in range(1, 13):
bay_sel.append_option('Bay %s' % i, 'Bay %s' % i)
try:
bay_sel.set_value(self.bay)
except AttributeError:
pass
return bay_sel
示例11: get_assigned_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_assigned_select(self, assigned):
workers_search = Search("sthpw/login")
workers_search.add_filter('location', 'internal')
workers_search.add_filter('license_type', 'user')
workers = workers_search.get_sobjects()
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.get_value('login'), worker.get_value('login'))
return work_sel
示例12: get_sel
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例13: get_description_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_description_select_wdg(name, value=None):
select_wdg = SelectWdg(name)
select_wdg.set_id(name)
select_wdg.add_empty_option()
description_search = Search('twog/prequal_line_description')
descriptions = description_search.get_sobjects()
for description in descriptions:
select_wdg.append_option(description.get_value('name'), description.get_code())
if value:
select_wdg.set_value(value)
return select_wdg
示例14: get_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
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
示例15: get_status_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_value [as 别名]
def get_status_select(self):
status_sel = SelectWdg('status_select')
status_sel.set_id('status')
status_sel.add_style('width', '135px')
status_sel.add_empty_option()
statuses = ('Approved', 'In Progress', 'Rejected')
for status in statuses:
status_sel.append_option(status, status)
if hasattr(self, 'status'):
status_sel.set_value(self.status)
return status_sel