本文整理汇总了Python中pyasm.widget.SelectWdg.set_persistence方法的典型用法代码示例。如果您正苦于以下问题:Python SelectWdg.set_persistence方法的具体用法?Python SelectWdg.set_persistence怎么用?Python SelectWdg.set_persistence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.SelectWdg
的用法示例。
在下文中一共展示了SelectWdg.set_persistence方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_file_type_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def get_file_type_wdg(my):
'''drop down which selects which file type to export to'''
# add a filter
div = DivWdg()
filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
div.add(filter_div)
select = SelectWdg()
select.set_name("file_type")
select.set_id("file_type")
app = WebContainer.get_web().get_selected_app()
if app == 'Maya':
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
elif app == 'Houdini':
select.set_option("values", "otl")
select.set_option("labels", "Houdini Digital Asset(.otl)")
elif app == 'XSI':
select.set_option("values", "emdl|dotXSI|obj")
select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
else:
select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
select.add_style("font-size: 0.8em")
select.add_style("margin-top: 5px")
select.add_style("margin-right: 10px")
select.set_persistence()
div.add(select)
return div
示例2: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [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
示例3: get_filter_wdg
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def get_filter_wdg(my):
div = DivWdg()
div.add_style("padding: 10px")
div.add_style("margin: -10 -10 10 -10")
div.add_style("min-width: 600px")
div.add_class("spt_view_manager_filter")
from tactic.ui.app import HelpButtonWdg
help_wdg = HelpButtonWdg(alias="view-manager|what-are-views")
div.add(help_wdg)
help_wdg.add_style("float: right")
div.add("<b>Search Type:</b> ")
div.add_gradient("background", "background", -10)
security = Environment.get_security()
project = Project.get()
if security.check_access("builtin", "view_site_admin", "allow"):
search_type_objs = project.get_search_types(include_sthpw=True, include_config=True)
else:
search_type_objs = project.get_search_types()
search_types = [x.get_value("search_type") for x in search_type_objs]
titles = ["%s (%s)" % (x.get_value("search_type"), x.get_value("title")) for x in search_type_objs]
select = SelectWdg(name="search_type")
select.set_option("values", search_types)
select.set_option("labels", titles)
select.add_empty_option("-- Select --")
select.set_persistence()
# select.set_persist_on_submit()
# security = Environment.get_security()
# if security.check_access("builtin", "view_site_admin", "allow"):
# select_mode = SearchTypeSelectWdg.ALL
# else:
# select_mode = SearchTypeSelectWdg.ALL_BUT_STHPW
# select = SearchTypeSelectWdg(name='search_type', \
# mode=select_mode)
behavior = {
"type": "change",
"cbjs_action": """
var manager_top = bvr.src_el.getParent(".spt_view_manager_top");
var input = spt.api.Utility.get_input(manager_top, 'search_type');
var view_input = spt.api.Utility.get_input(manager_top, 'view');
var view_input_value = '';
if (view_input != null) {
view_input_value = view_input.value;
}
var values = {'search_type': input.value, 'view': view_input_value, 'is_refresh': 'true'};
spt.panel.refresh(manager_top, values);"""
# //spt.panel.refresh(manager_top, values);'''
}
select.add_behavior(behavior)
select.set_value(my.search_type)
div.add(select)
if not my.search_type:
content = DivWdg()
content.add_style("width: 400px")
content.add_style("height: 400px")
div.add(content)
content.add_style("padding: 20px")
content.add(IconWdg("WARNING", IconWdg.WARNING))
content.add("No Search Type Selected")
content.add_border()
content.add_style("margin-top: 20px")
content.add_color("background", "background")
content.add_style("font-weight: bold")
return div
div.add(" ")
div.add("<b>View: </b>")
view_wdg = SelectWdg("view")
view_wdg.set_value(my.view)
view_wdg.add_empty_option("-- Select --")
view_wdg.add_behavior(behavior)
div.add(view_wdg)
search = Search("config/widget_config")
search.add_filter("search_type", my.search_type)
db_configs = search.get_sobjects()
views = set()
for db_config in db_configs:
view = db_config.get_value("view")
if view.startswith("link_search:"):
continue
views.update([view])
# print "search_type: ", my.search_type
# print "view: ", views, my.view
if my.search_type and my.view:
#.........这里部分代码省略.........
示例4: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def get_display(self):
self.check()
if self.is_refresh:
div = Widget()
else:
div = DivWdg()
self.set_as_panel(div)
div.add_style('padding','6px')
min_width = '400px'
div.add_style('min-width', min_width)
div.add_color('background','background')
div.add_class('spt_add_task_panel')
div.add_style("padding: 20px")
from tactic.ui.app import HelpButtonWdg
help_button = HelpButtonWdg(alias="creating-tasks")
div.add(help_button)
help_button.add_style("float: right")
help_button.add_style("margin-top: -5px")
if not self.search_key_list:
msg_div = DivWdg()
msg_table = Table()
msg_div.add(msg_table)
msg_table.add_row()
msg_table.add_cell( IconWdg("No items selected", IconWdg.WARNING) )
msg_table.add_cell('Please select at least 1 item to add tasks to.')
msg_div.add_style('margin: 10px')
msg_table.add_style("font-weight: bold")
div.add(msg_div)
return div
msg_div = DivWdg()
msg_div.add_style('margin-left: 4px')
div.add(msg_div, 'info')
msg_div.add('Total: %s item/s to add tasks to' %len(self.search_key_list))
div.add(HtmlElement.br())
hint = HintWdg('Tasks are added according to the assigned pipeline.')
msg_div.add(" ")
msg_div.add(hint)
msg_div.add(HtmlElement.br())
option_div = DivWdg(css='spt_ui_options')
#option_div.add_style('margin-left: 12px')
sel = SelectWdg('pipeline_mode', label='Create tasks by: ')
sel.set_option('values', ['simple process','context', 'standard'])
sel.set_option('labels', ['process','context', 'all contexts in process'])
sel.set_persistence()
sel.add_behavior({'type':'change',
'cbjs_action': 'spt.panel.refresh(bvr.src_el)'})
option_div.add(sel)
value = sel.get_value()
# default to simple process
if not value:
value = 'simple process'
msg = ''
if value not in ['simple process','context','standard']:
value = 'simple process'
if value == 'context':
msg = 'In context mode, a single task will be created for each selected context.'
elif value == 'simple process':
msg = 'In process mode, a single task will be created for each selected process.'
elif value == 'standard':
msg = 'In this mode, a task will be created for all contexts of each selected process.'
option_div.add(HintWdg(msg))
div.add(option_div)
div.add(HtmlElement.br())
title = DivWdg('Assigned Pipelines')
title.add_style('padding: 6px')
title.add_color('background','background2')
title.add_color('color','color', +120)
div.add(title)
content_div = DivWdg()
content_div.add_style('min-height', '150px')
div.add(content_div)
content_div.add_border()
filtered_search_key_list = []
for sk in self.search_key_list:
id = SearchKey.extract_id(sk)
if id=='-1':
continue
filtered_search_key_list.append(sk)
sobjects = SearchKey.get_by_search_keys(filtered_search_key_list)
skipped = []
pipeline_codes = []
for sobject in sobjects:
if isinstance(sobject, Task):
#.........这里部分代码省略.........
示例5: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def get_display(self):
# add the detail widget
detail_wdg = DivWdg(css='spt_detail_panel')
if not self.name_string and not self.config_string:
detail_wdg.add("<br/>"*3)
detail_wdg.add('<- Click on an item on the left for modification.')
detail_wdg.add_style("padding: 10px")
detail_wdg.add_color("background", "background", -5)
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("height: 400px")
detail_wdg.add_border()
return detail_wdg
if self.kwargs.get("mode") == "empty":
overlay = DivWdg()
detail_wdg.add(overlay)
detail_wdg.add_border()
detail_wdg.add_color("color", "black")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_color("background", "background", -5)
detail_wdg.set_id('search_type_detail')
# put in the selection for simple or advanced
select = SelectWdg("config_mode", label='Mode: ')
select.set_persistence()
values = ['simple', 'advanced']
select.set_option("values", values)
config_mode = select.get_value()
#select.add_behavior({"type": "change", "cbjs_action": "spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_simple') )"})
select.add_behavior({"type": "change", "cbjs_action": \
"spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_advanced')); %s" %select.get_save_script()})
select.add_class('spt_config_mode')
title_div = DivWdg("Column Detail")
title_div.add_class("maq_search_bar")
detail_wdg.add(title_div)
detail_wdg.add("<br/>")
detail_wdg.add(select)
detail_wdg.add(HtmlElement.br(2))
#simple_mode_wdg = WidgetDetailSimpleModeWdg()
#detail_wdg.add(simple_mode_wdg)
#detail_wdg.add(HtmlElement.br(2))
if self.is_new_column:
detail_wdg.add( self.get_new_definition_wdg() )
else:
simple_wdg = self.get_simple_definition_wdg()
simple_wdg.add_class("config_simple")
detail_wdg.add( simple_wdg )
adv_wdg = self.get_advanced_definition_wdg()
adv_wdg.add_class("config_advanced")
if config_mode == 'simple':
adv_wdg.add_style('display: none')
detail_wdg.add(HtmlElement.br(2))
detail_wdg.add( adv_wdg )
detail_wdg.add(HtmlElement.br(2))
security_wdg = self.get_security_wdg()
detail_wdg.add(security_wdg)
# add hidden input for view for panel refreshing
# we are only interested in whether it is project_view or definition
# sub-views of project_view is not of our interest
#if self.view != 'project_view':
# self.view = 'custom_definition'
detail_wdg.add(HiddenWdg('view', self.view))
return detail_wdg
示例6: init
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def init(my):
search = Search("sthpw/queue")
search.add_order_by("priority desc")
search.add_order_by("timestamp desc")
widget = Widget()
div = DivWdg(css="filter_box")
span = SpanWdg(css="med")
from pyasm.prod.web import SearchFilterWdg
search_filter = SearchFilterWdg(columns=Queue.get_search_columns())
search_filter.alter_search(search)
span.add(search_filter)
div.add(span)
span = SpanWdg(css="med")
priority_wdg = TextWdg("priority_search")
priority_wdg.set_persistence()
priority = priority_wdg.get_value()
if priority:
search.add_filter("priority", priority)
span.add("Priority: ")
span.add(priority_wdg)
div.add(span)
select = SelectWdg("queue_state")
select.set_option("values", "|pending|locked|error|done")
select.set_option("labels", "All|pending|locked|error|done")
select.add_event("onchange", "document.form.submit()")
select.set_persistence()
span = SpanWdg(css="med")
span.add("State: ")
span.add(select)
div.add(span)
queue_state = select.get_value()
if queue_state != "":
search.add_filter("state", queue_state)
user_select = SelectWdg("user_select")
user_select.add_empty_option()
user_search = Search("sthpw/login")
user_select.set_search_for_options(user_search, "login", "login")
user_select.add_event("onchange", "document.form.submit()")
user_select.set_persistence()
div.add("User: ")
div.add(user_select)
queue_user = user_select.get_value()
if queue_user != "":
search.add_filter("login", queue_user)
search_limit = SearchLimitWdg()
search_limit.set_limit(10)
div.add(search_limit)
search_limit.alter_search(search)
widget.add(div)
sobjects = search.get_sobjects()
table = TableWdg("sthpw/queue")
table.set_sobjects(sobjects)
widget.add(table)
my.add(widget)
示例7: get_display
# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_persistence [as 别名]
def get_display(self):
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 as e:
return div
except SqlException as e:
return div
# add the view selector
view_select = SelectWdg("view")
view_select.add_empty_option("-- View --")
view_select.add_event("onchange", "document.form.submit()")
view_select.set_persist_on_submit()
#view_select.set_persistence()
span = SpanWdg(css="med")
span.add("Defined Views: ")
span.add(view_select)
div.add(span)
div.add( self.get_create_view_wdg(search_type))
div.add( HtmlElement.br(2) )
div.add( self.get_new_tab_wdg() )
widget.add(div)
search = Search("sthpw/widget_config")
#search.add_user_filter()
search.add_filter("search_type", search_type)
search.add_where("view != 'definition' and view != 'custom'")
#search.add_column("view")
widget_configs = search.get_sobjects()
if widget_configs:
view_select.set_sobjects_for_options(widget_configs,"view","view")
view = view_select.get_value()
if not view:
view = "custom"
#return widget
# get the selected widget config
for widget_config in widget_configs:
if widget_config.get_value("view") == view:
break
else:
return widget
# get the handler: a little HACKY.
config_xml = widget_config.get_xml_value("config")
handler = config_xml.get_value("config/%s/@handler" % view)
if not search_type:
return widget
#.........这里部分代码省略.........