本文整理汇总了Python中pyasm.widget.SelectWdg.add_empty_option方法的典型用法代码示例。如果您正苦于以下问题:Python SelectWdg.add_empty_option方法的具体用法?Python SelectWdg.add_empty_option怎么用?Python SelectWdg.add_empty_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.SelectWdg
的用法示例。
在下文中一共展示了SelectWdg.add_empty_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_security_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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
示例2: get_task_status_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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_frame_rate_section
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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
示例4: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
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_file_in_package_status_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
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
示例6: get_input_by_arg_key
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
def get_input_by_arg_key(self, key):
if key == 'icon':
input = SelectWdg("option_icon_select")
input.set_option("values", IconWdg.get_icons_keys())
input.add_empty_option("-- Select --")
elif key == 'script':
input = SelectWdg("option_script_select")
input.set_option("query", "config/custom_script|code|code" )
input.add_empty_option("-- Select --")
else:
input = TextWdg("value")
return input
示例7: get_action_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
def get_action_wdg(my):
filter_div = DivWdg()
select = SelectWdg("filter_action")
select.add_empty_option("-- search action --")
select.add_style("text-align: right")
select.set_option("labels", "Retrieve Search|Save Search")
select.set_option("values", "retrieve|save")
select.add_event("onchange", "spt.dg_table.search_action_cbk(this)")
filter_div.add(select)
return filter_div
示例8: get_title_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
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
示例9: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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
示例10: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
def get_display(self):
# add a view action
view_div = DivWdg()
view_select = SelectWdg("action|view_action")
view_select.add_style("text-align: right")
view_select.add_empty_option("-- view --")
view_select.set_option("values", "copy_url|add_my_view|edit|save|rename|delete|custom_property|custom_script")
view_select.set_option("labels", "X Copy URL to this View|Add to My Views|Edit as Draft|Save Project View As|X Rename View|X Delete View|Add Custom Property|Add Custom Script")
view_div.add_style("float: right")
view_div.add(view_select)
view_select.add_event("onchange", "spt.dg_table.view_action_cbk(this,'%s')" % self.table_id)
return view_div
示例11: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
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
示例12: get_bay_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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
示例13: get_style_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
def get_style_select(self):
style_sel = SelectWdg('style_select')
style_sel.set_id('style')
style_sel.add_style('width: 135px;')
style_sel.add_empty_option()
for style in ('Technical', 'Spot QC', 'Mastering'):
style_sel.append_option(style, style)
try:
style_sel.set_value(self.style_sel)
except AttributeError:
pass
return style_sel
示例14: get_status_select
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [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
示例15: get_instructions_select_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_empty_option [as 别名]
def get_instructions_select_wdg():
"""
Get a Select Widget with all the instructions options
:return: SelectWdg
"""
instructions_search = Search('twog/instructions')
instructions_select_wdg = SelectWdg('instructions_select')
instructions_select_wdg.set_id('instructions_select')
instructions_select_wdg.add_empty_option()
instructions_select_wdg.set_search_for_options(instructions_search, 'code', 'name')
return instructions_select_wdg