本文整理汇总了Python中pyasm.widget.CheckboxWdg.set_option方法的典型用法代码示例。如果您正苦于以下问题:Python CheckboxWdg.set_option方法的具体用法?Python CheckboxWdg.set_option怎么用?Python CheckboxWdg.set_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.CheckboxWdg
的用法示例。
在下文中一共展示了CheckboxWdg.set_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_instantiation_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_instantiation_wdg(self):
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
div = DivWdg()
is_unchecked = True
default_cb = None
for value in self.get_instantiation_options():
name = self.get_element_name("instantiation")
checkbox = CheckboxWdg( name )
if value == default_instantiation:
default_cb = checkbox
checkbox.set_option("value", value)
checkbox.set_persistence()
if checkbox.is_checked():
is_unchecked = False
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
span = SpanWdg(checkbox, css='small')
span.add(value)
div.add(span)
if is_unchecked:
default_cb.set_checked()
return div
示例2: init
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def init(self):
self.add("Process: ")
checkbox = CheckboxWdg("process")
checkbox.set_option("value", "on")
checkbox.set_persistence()
checkbox.add_event("onclick", "document.form.submit()")
self.add(checkbox)
示例3: _get_target_span
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def _get_target_span(my):
# get the target span
search = Search(my.container_cls)
my._order_search(search)
groups = search.get_sobjects()
if groups:
my.container_sobj = groups[0]
target_span = SpanWdg(css='med')
group_table = Table(my.GROUP_TABLE_NAME, css='table')
group_table.add_style('width','30em')
group_table.add_col(css='small')
group_table.add_col(css='small')
group_table.add_col()
target_span.add(group_table)
group_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
checkbox = CheckboxWdg()
checkbox.set_option("onclick", \
"a=new Elements('container_ids');a.toggle_all(this);")
group_table.add_row()
group_table.add_cell(checkbox)
col_name = group_table.get_next_col_name()
toggle_control = HiddenRowToggleWdg(col_name=col_name, is_control=True, auto_index=True)
group_table.add_cell(toggle_control)
group_table.add_cell('MASTER CONTROL')
remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
my.add(remove_cmd)
for group in groups:
group_table.add_row()
checkbox = CheckboxWdg("container_ids")
checkbox.set_option("value", group.get_primary_key_value() )
toggle = HiddenRowToggleWdg(col_name, auto_index=True)
toggle.store_event()
group_details = ItemInContainerWdg( group, my.item_sobj, my.item_cls, my.grouping_cls )
# set the target content of the toggle
toggle.set_static_content(group_details)
group_table.add_cell( checkbox )
group_table.add_cell( toggle, add_hidden_wdg=True )
group_table.add_cell( group.get_description())
num_items = group_details.get_num_items()
if num_items:
td = group_table.add_cell( "( %s )" % num_items, 'no_wrap')
td.add_color(color)
else:
group_table.add_blank_cell()
return target_span
示例4: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_display(my):
sobject = my.get_current_sobject()
checkbox = CheckboxWdg()
checkbox.set_name(my.name)
checkbox.set_option( "value", sobject.get_search_key() )
return checkbox
示例5: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_display(self):
sobject = self.get_current_sobject()
search_key = sobject.get_search_key()
div = DivWdg()
checkbox = CheckboxWdg("search_key")
checkbox.set_option("value", search_key)
div.add(checkbox)
return div
示例6: get_format_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_format_wdg(self, value, format, display_value):
div = DivWdg()
if format not in ['Checkbox'] and value == '':
return div
if format == 'Checkbox':
div.add_style("width: 100%")
div.add_class("spt_boolean_top")
from pyasm.widget import CheckboxWdg
checkbox = CheckboxWdg(self.get_name())
checkbox.set_option("value", "true")
if value:
checkbox.set_checked()
div.add(checkbox)
checkbox.add_behavior( {
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var cached_data = {};
var value_wdg = bvr.src_el;
var top_el = bvr.src_el.getParent(".spt_boolean_top");
spt.dg_table.edit.widget = top_el;
var key_code = spt.kbd.special_keys_map.ENTER;
spt.dg_table.inline_edit_cell_cbk( value_wdg, cached_data );
'''
} )
elif format == '-$1,234.00':
if value < 0:
div.add_style("color: red")
div.add("(%s)" % display_value.replace("-", ""))
else:
div.add_style("color: black")
div.add(display_value)
else:
div.add(display_value)
return div
示例7: init
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def init(my):
my.item_cls = my.kwargs.get('left_search_type')
my.container_cls = my.kwargs.get('right_search_type')
my.grouping_cls = my.kwargs.get('search_type')
my.item_sobj = my.container_sobj = None
# List the items
search = Search(my.item_cls)
my._order_search(search)
items = search.get_sobjects()
if items:
my.item_sobj = items[0]
#select = MultiSelectWdg("item_ids")
#select.set_search_for_options(search,"login", "get_full_name()")
user_span = SpanWdg(css='med')
user_table = Table(css='table')
user_table.add_style("margin-left: 6px")
user_table.set_max_width()
user_table.add_col(css='small')
user_table.add_col()
user_table.add_style("min-width: 14em")
user_table.add_row_cell(search.get_search_type_obj()\
.get_description(), "heading")
for item in items:
user_table.add_row()
checkbox = CheckboxWdg("item_ids")
checkbox.set_option("value", item.get_primary_key_value() )
user_table.add_cell( checkbox )
project_code = item.get_value("project_code", no_exception=True)
if project_code:
user_table.add_cell( "[ %s ]" % project_code )
else:
user_table.add_cell( "[ * ]" )
user_table.add_cell( item.get_description() )
user_span.add(user_table)
# control widget in the middle
control_div = DivWdg()
control_div.add_style('padding: 100px 10px 0 10px')
button = IconSubmitWdg(my.ADD_LABEL, "stock_insert-slide.png", True)
button.add_style('padding: 2px 30px 4px 30px')
control_div.add(button)
main_table = Table(css='collapse')
main_table.set_max_width()
main_table.add_row(css='plain_bg')
main_table.add_cell(user_span, 'valign_top')
td = main_table.add_cell(control_div, 'valign_top')
td.add_style('width','12em')
main_table.add_cell(my._get_target_span(), 'valign_top')
my.add(main_table)
# register command here
if my.item_sobj and my.container_sobj:
marshaller = WebContainer.register_cmd("pyasm.widget.SObjectGroupCmd")
marshaller.set_option("grouping_search_type", my.grouping_cls)
marshaller.set_option("item_foreign_key", my.item_sobj.get_foreign_key())
marshaller.set_option("container_foreign_key", my.container_sobj.get_foreign_key())
示例8: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
#.........这里部分代码省略.........
return table
# use overriding element names and derived titles if available
config = WidgetConfigView.get_by_search_type(my.search_type, my.view)
if my.element_names and config:
filtered_columns = my.element_names
titles = []
for name in my.element_names:
title = config.get_element_title(name)
titles.append(title)
else:
# excluding FunctionalTableElement
filtered_columns = []
titles = []
if not config:
columns = search.get_columns()
filtered_columns = columns
titles = ['n/a'] * len(filtered_columns)
else:
columns = config.get_element_names()
filtered_columns = columns
titles = config.get_element_titles()
"""
# commented out until it is decided 2.5 widgets will
# use this class to differentiate between reg and functional element
from pyasm.widget import FunctionalTableElement
for column in columns:
widget = config.get_display_widget(column)
if isinstance(widget, FunctionalTableElement):
continue
filtered_columns.append(column)
"""
for idx, column in enumerate(filtered_columns):
table.add_row()
cb = CheckboxWdg(cb_name)
cb.set_option('value', column)
cb.set_checked()
table.add_cell(cb)
title = titles[idx]
table.add_cell('<b>%s</b> (%s) '%(title, column))
action_div = DivWdg()
widget = DivWdg()
table.add_row_cell(widget)
widget.add_style("margin: 20px 0 10px 0px")
cb = CheckboxWdg('include_id', label=" Include ID")
cb.set_default_checked()
widget.add(cb)
hint = HintWdg('To update entries with specific ID later, please check this option. For new inserts in this or other table later on, uncheck this option.')
widget.add(hint)
label = string.capwords(my.mode.replace('_', ' '))
button = ActionButtonWdg(title=label)
is_export_all = my.mode == 'export_all'
button.add_behavior({
'type': "click_up",
'cbfn_action': 'spt.dg_table_action.csv_export',
'element': 'csv_export',
'column_names': 'csv_column_name',
'search_type': my.search_type,
'view': my.view,
'search_keys' : my.selected_search_keys,
'is_export_all' : is_export_all
})
my.close_action = "var popup = bvr.src_el.getParent('.spt_popup');spt.popup.close(popup)"
if my.close_action:
close_button = ActionButtonWdg(title='Close')
close_button.add_behavior({
'type': "click",
'cbjs_action': my.close_action
})
table = Table()
action_div.add(table)
table.center()
table.add_row()
td = table.add_cell(button)
td.add_style("width: 130px")
table.add_cell(close_button)
action_div.add("<br clear='all'/>")
top.add(div)
top.add(HtmlElement.br())
top.add(action_div)
return top
示例9: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_display(self):
widget = Widget()
div = DivWdg(css='spt_ui_options')
div.set_unique_id()
table = Table()
div.add(table)
table.add_style("margin: 5px 15px")
table.add_color('color','color')
swap = SwapDisplayWdg()
#swap.set_off()
app = WebContainer.get_web().get_selected_app()
outer_span = SpanWdg()
outer_span.add_style('float: right')
span = SpanWdg(app, css='small')
icon = IconWdg(icon=eval("IconWdg.%s"%app.upper()), width='13px')
outer_span.add(span)
outer_span.add(icon)
title = SpanWdg("Loading Options")
title.add(outer_span)
SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False)
widget.add(swap)
widget.add(title)
widget.add(div)
if not self.hide_instantiation:
table.add_row()
table.add_blank_cell()
div = DivWdg(HtmlElement.b("Instantiation: "))
table.add_cell(div)
div = self.get_instantiation_wdg()
table.add_cell(div)
setting = self.get_default_setting()
default_instantiation = setting.get('instantiation')
default_connection = setting.get('connection')
default_dependency = setting.get('texture_dependency')
if not self.hide_connection:
table.add_row()
table.add_blank_cell()
con_div = DivWdg(HtmlElement.b("Connection: "))
table.add_cell(con_div)
td = table.add_cell()
is_unchecked = True
default_cb = None
for value in ['http', 'file system']:
name = self.get_element_name("connection")
checkbox = CheckboxWdg( name )
checkbox.set_option("value", value)
checkbox.set_persistence()
if value == default_connection:
default_cb = checkbox
if checkbox.is_checked():
is_unchecked = False
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
span = SpanWdg(checkbox, css='small')
span.add(value)
td.add(span)
if is_unchecked:
default_cb.set_checked()
if not self.hide_dependencies:
table.add_row()
table.add_blank_cell()
div = DivWdg(HtmlElement.b("Texture Dependencies: "))
table.add_cell(div)
td = table.add_cell()
is_unchecked = True
default_cb = None
for value in ['as checked in', 'latest', 'current']:
name = self.get_element_name("dependency")
checkbox = CheckboxWdg( name )
checkbox.set_option("value", value)
checkbox.set_persistence()
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True,
"cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name})
if value == default_dependency:
default_cb = checkbox
if checkbox.is_checked():
is_unchecked = False
span = SpanWdg(checkbox, css='small')
span.add(value)
#.........这里部分代码省略.........
示例10: get_viewer
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_viewer(self):
top = DivWdg(css='spt_single_note_viewer_top')
# draw checkbox options
swap = SwapDisplayWdg()
title = SpanWdg('context')
title.add_color('color','color')
div = DivWdg(css='spt_context_cb')
div.add_color('color','color')
SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False)
checkbox_name = 'split_screen'
checked_process_names = []
if self.show_context:
top.add(swap)
top.add(title)
top.add(div)
#checkbox_name = 'note_context_cb'
checkbox_name = self.checkbox_name
cb = CheckboxWdg(checkbox_name)
cb.persistence = True
cb.persistence_obj = cb
checked_process_names = cb.get_values()
for value in self.process_names:
#self.checked_process_names = web.get_form_values('process_names')
cb = CheckboxWdg(checkbox_name, label=value)
if value in checked_process_names:
self.checked_processes.append(value)
# FIXME: this is very tenous. Accessing private members to
# override behavior
cb.persistence = True
cb.persistence_obj = cb
key = cb.get_key()
cb.set_option('value', value)
cb.add_behavior({
'type': 'click_up',
'propagate_evt': True,
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_single_note_viewer_top")
var table_top = top.getElement('.spt_note_viewer_table');
var cbs = top.getElement('.spt_context_cb');
var values = spt.api.Utility.get_input_values(cbs);
var processes = values.%s;
var kwargs = { process_names: processes};
spt.input.save_selected(bvr, '%s','%s');
spt.panel.refresh(table_top, kwargs, false);
''' % (checkbox_name, checkbox_name, key)
})
div.add(cb)
else:
web = WebContainer.get_web()
checked_process_names = web.get_form_values('process_names')
table_top = DivWdg(css='spt_note_viewer_table')
expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(checked_process_names)
table_id = 'main_table1'
table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\
show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression )
if self.resize:
from tactic.ui.container import ResizeScrollWdg
inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' )
inner_wdg.add(table)
table_top.add(inner_wdg)
else:
table_top.add(table)
self.set_as_panel(table_top)
top.add(table_top)
return top
示例11: handle_instance
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def handle_instance(my, table, instance, asset, node_name='', publish=True, allow_ref_checkin=False):
# handle the case where asset is not defined
if not asset:
table.add_row()
table.add_blank_cell()
table.add_blank_cell()
# FIXME: Maya specific
parts = instance.split(":")
instance_name = parts[0]
asset_code = parts[1]
if instance_name == asset_code:
table.add_cell(instance_name)
else:
table.add_cell(instance)
td = table.add_cell()
td.add("< %s node >" % my.session.get_node_type(instance_name))
table.add_blank_cell()
return
# get the pipeline for this asset and handlers for the pipeline
process_name = my.process_select.get_value()
handler_hidden = my.get_handler_input(asset, process_name)
pipeline = Pipeline.get_by_sobject(asset)
# TEST: switch this to using node name instead, if provided
if node_name:
instance_node = my.session.get_node(node_name)
else:
instance_node = my.session.get_node(instance)
if instance_node is None:
return
if Xml.get_attribute(instance_node,"reference") == "true":
is_ref = True
else:
is_ref = False
namespace = Xml.get_attribute(instance_node, "namespace")
if not namespace:
namespace = instance
asset_code = asset.get_code()
is_set = False
if asset.get_value('asset_type', no_exception=True) in ['set','section']:
is_set = True
tr = table.add_row()
if is_set:
tr.add_class("group")
if publish and (allow_ref_checkin or not is_ref):
checkbox = CheckboxWdg("asset_instances")
if is_set:
checkbox = CheckboxWdg("set_instances")
checkbox.set_option("value", "%s|%s|%s" % \
(namespace, asset_code, instance) )
checkbox.set_persist_on_submit()
td = table.add_cell(checkbox)
else:
td = table.add_blank_cell()
# only one will be added even if there are multiple
if handler_hidden:
td.add(handler_hidden)
# add the thumbnail
thumb = ThumbWdg()
thumb.set_name("images")
thumb.set_sobject(asset)
thumb.set_icon_size(60)
table.add_cell(thumb)
info_wdg = Widget()
info_wdg.add(HtmlElement.b(instance))
if not node_name:
node_name = '%s - %s' %(asset_code, asset.get_name())
info_div = DivWdg(node_name)
info_div.add_style('font-size: 0.8em')
info_wdg.add(info_div)
info_div.add(HtmlElement.br(2))
if pipeline:
info_div.add(pipeline.get_code())
table.add_cell(info_wdg)
# by default can't checkin references
if not allow_ref_checkin and is_ref:
#icon = IconWdg("error", IconWdg.ERROR)
#.........这里部分代码省略.........
示例12: get_bottom_wdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_bottom_wdg(my):
if my.get_option('mode') =='input':
return
web = WebContainer.get_web()
if web.get_selected_app() not in ['XSI','Maya']:
return
div = DivWdg(css='spt_outdated_ref')
refs = my.session.get_data().get_nodes("session/node/ref")
snap_codes = []
snap_contexts = []
sobjects = []
session_data_dict = {}
asset_codes = []
current_snapshots = []
node_names = []
session_versions = []
for ref in refs:
snap_code = Xml.get_attribute(ref, "asset_snapshot_code")
node_name = Xml.get_attribute(ref, "name")
version = Xml.get_attribute(ref, "asset_snapshot_version")
asset_code = Xml.get_attribute(ref, "asset_code")
if snap_code in snap_codes:
continue
snap_codes.append(snap_code)
snap_contexts.append(Xml.get_attribute(ref, "asset_snapshot_context"))
asset_codes.append(asset_code)
session_data_dict[snap_code] = version, node_name
# must search one by one
warnings=[]
for idx, snap_code in enumerate(snap_codes):
snapshot = Snapshot.get_by_code(snap_code)
if not snapshot:
continue
search_type = snapshot.get_value('search_type')
search_id = snapshot.get_value('search_id')
sk = SearchKey.build_search_key(search_type, search_id, column='id')
current_snapshot = Snapshot.get_snapshot(search_type, search_id, context=snap_contexts[idx], version=0)
if not current_snapshot:
warnings.append("Current version for [%s] context [%s] not found" %(sk, snap_contexts[idx]))
continue
session_version, node_name = session_data_dict.get(snap_code)
if session_version and int(current_snapshot.get_version()) > int(session_version):
current_snapshots.append(current_snapshot)
sobjects.append(current_snapshot.get_sobject())
node_names.append(node_name)
session_versions.append(int(session_version))
title = DivWdg('Outdated References')
title.add_style('text-decoration','underline')
div.add(title)
# draw the nodes to be udpated
for idx, current_snap in enumerate(current_snapshots):
cb = CheckboxWdg(my.REF_CB_NAME)
cb.add_class('spt_ref')
cb.add_style('display: none')
sobj = sobjects[idx]
node_name = node_names[idx]
session_version = session_versions[idx]
snapshot = current_snap
cb_value = my.get_input_value(sobj, snapshot)
items = cb_value.split('|')
items[-1] = node_name
cb_value = '|'.join(items)
cb.set_option('value', cb_value)
div.add(cb)
div.add('%0.1d. %s v%0.3d -> v%0.3d\n' \
%(idx+1, node_name, session_version, snapshot.get_version()))
div.add(HtmlElement.br())
for warning in warnings:
div.add(SpanWdg(warning, css='warning'))
div.add(HtmlElement.br())
if current_snapshots:
# add the button
prefix = my.search_type
#input_name = '%s_%s' %(my.search_type, my.CB_NAME)
update_button = ProdIconButtonWdg("Update all references")
update_button.add_behavior({'type': "click_up",\
'cbjs_action': '''var cousins = bvr.src_el.getParent('.spt_outdated_ref').getElements('.spt_ref');
cousins.each( function(x) {x.checked=true;}); py_replace_reference(bvr, '%s','%s')'''
% (prefix, my.REF_CB_NAME)})
div.add( SpanWdg(update_button, css='small'))
div.add(HtmlElement.br(2))
return div
示例13: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
def get_display(my):
my.init_kwargs()
sobject = my.get_current_sobject()
table = Table(css='minimal')
table.add_color("color", "color")
table.add_style("font-size: 0.9em")
snapshots = my.get_snapshot(my.mode)
for snapshot in snapshots:
table.add_row()
value = my.get_input_value(sobject, snapshot)
current_version = snapshot.get_value("version")
current_context = snapshot.get_value("context")
current_revision = snapshot.get_value("revision", no_exception=True)
current_snapshot_type = snapshot.get_value("snapshot_type")
# hack hard coded type translation
if current_snapshot_type == "anim_export":
current_snapshot_type = "anim"
# ignore icon context completely
if current_context == "icon":
table.add_blank_cell()
table.add_cell("(---)")
return table
checkbox = CheckboxWdg('%s_%s' %(my.search_type, my.CB_NAME))
# this is added back in for now to work with 3.7 Fast table
checkbox.add_behavior({'type': 'click_up',
'propagate_evt': True})
checkbox.add_class('spt_latest_%s' %my.mode)
checkbox.set_option("value", value )
table.add_cell( checkbox )
load_all = False
if load_all:
checkbox.set_checked()
# add the file type icon
xml = snapshot.get_snapshot_xml()
file_name = xml.get_value("snapshot/file/@name")
icon_link = ThumbWdg.find_icon_link(file_name)
image = HtmlElement.img(icon_link)
image.add_style("width: 15px")
table.add_cell(image)
namespace = my.get_namespace(sobject, snapshot)
asset_code = my.get_asset_code()
# force asset mode = True
my.session.set_asset_mode(asset_mode=my.get_session_asset_mode())
node_name = my.get_node_name(snapshot, asset_code, namespace)
# get session info
session_context = session_version = session_revision = None
if my.session:
session_context = my.session.get_context(node_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(node_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(node_name, asset_code,current_snapshot_type)
# Maya Specific: try with namespace in front of it for referencing
referenced_name = '%s:%s' %(namespace, node_name)
if not session_context or not session_version:
session_context = my.session.get_context(referenced_name, asset_code, current_snapshot_type)
session_version = my.session.get_version(referenced_name, asset_code, current_snapshot_type)
session_revision = my.session.get_revision(referenced_name, asset_code, current_snapshot_type)
from version_wdg import CurrentVersionContextWdg, SubRefWdg
version_wdg = CurrentVersionContextWdg()
data = {'session_version': session_version, \
'session_context': session_context, \
'session_revision': session_revision, \
'current_context': current_context, \
'current_version': current_version, \
'current_revision': current_revision }
version_wdg.set_options(data)
table.add_cell(version_wdg, "no_wrap")
td = table.add_cell(HtmlElement.b("(%s)" %current_context))
td.add_tip("Snapshot code: %s" % snapshot.get_code())
#table.add_cell(snapshot.get_code() )
#if snapshot.is_current():
# current = IconWdg("current", IconWdg.CURRENT)
# table.add_cell(current)
#else:
# table.add_blank_cell()
# handle subreferences
#.........这里部分代码省略.........
示例14: ArtistViewWdg
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
class ArtistViewWdg(SpanWdg):
def init(self):
self.add("Show assigned only: ")
self.checkbox = CheckboxWdg("show_assigned_only")
self.checkbox.set_option("value", "on")
self.checkbox.set_persistence()
self.checkbox.add_event("onclick", "document.form.submit()")
self.add(self.checkbox)
self.add_class("med")
def is_supervisor(self):
# if the user is a supervisor, look at all of the assets
project = Project.get_project_name()
security = Environment.get_security()
return security.check_access("prod/%s" % project, "model/supervisor", "true")
def is_artist(self):
# if the user is a artist, look at all of the assets
project = Project.get_project_name()
security = Environment.get_security()
return security.check_access("prod/%s" % project, "model/artist", "true")
def alter_search(self, search):
# get all of the relevant tasks to the user
task_search = Search("sthpw/task")
task_search.add_column("search_id")
# only look at this project
project = Project.get_project_name()
task_search.add_filter("search_type", search.get_search_type())
# figure out who the user is
security = Environment.get_security()
login = security.get_login()
user = login.get_value("login")
print "is_artist: ", self.is_artist()
print "is_supervisor: ", self.is_supervisor()
# do some filtering
web = WebContainer.get_web()
show_assigned_only = self.checkbox.get_value()
show_process = web.get_form_values("process")
if not show_process or show_process[0] == '':
show_process = []
show_task_status = web.get_form_values("task_status")
if not show_task_status or show_task_status[0] == '':
show_task_status = []
if show_assigned_only == "on":
task_search.add_filter("assigned", user)
if show_process:
where = "process in (%s)" % ", ".join( ["'%s'" % x for x in show_process] )
task_search.add_where(where)
if show_task_status:
where = "status in (%s)" % ", ".join( ["'%s'" % x for x in show_task_status] )
task_search.add_where(where)
else:
task_search.add_where("NULL")
# record the tasks
self.tasks = task_search.get_sobjects()
# get all of the sobject ids
sobject_ids = ["'%s'" % x.get_value("search_id") for x in self.tasks]
# get all of the sobjects related to this task
if sobject_ids:
search.add_where( "id in (%s)" % ", ".join(sobject_ids) )
示例15: get_display
# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_option [as 别名]
#.........这里部分代码省略.........
process_div.add_color("background", "background")
process_div.add_color("color", "color")
process_div.add_border()
refresh = ActionButtonWdg(title="Refresh")
refresh.add_style('margin: 0 auto 10px auto')
process_div.add(refresh)
refresh.add_behavior( {
'type': 'click_up',
'cbjs_action': '''
var top = bvr.src_el.getParent(".spt_uber_notes_top");
var tbody = top.getElements('.spt_table_tbody')[2];
var values = spt.api.Utility.get_input_values(tbody);
spt.panel.refresh(top, values, false);
'''
} )
process_div.add("<hr/>")
selected_process_names = []
step = 0
for idx, value in enumerate(self.process_names):
checkbox_name = 'note_process_cb'
if self.child_mode:
selected_process_names.append(value)
#break
cb = CheckboxWdg(checkbox_name, label=value)
cb.persistence = True
cb.persistence_obj = cb
key = cb.get_key()
cb.set_option('value', value)
#cb.set_persistence()
cb.add_behavior({
'type': 'click_up',
'cbjs_action': '''
spt.input.save_selected(bvr, '%s','%s');
''' % (checkbox_name, key)
})
# only 1 is selected in child_mode
if cb.is_checked():
selected_process_names.append(value)
if idx == 0 or idx == 10 * step:
# add a new inner div
inner_div = self._get_inner_div()
process_div.add(inner_div, 'inner%s'%step)
step += 1
inner_div.add(cb)
inner_div.add("<br/>")
# if less than 10, make it wider
if len(self.process_names) < 10:
inner_div.add_style('width: 100px')
# add a master private checkbox
if not self.child_mode:
checkbox_name = 'note_master_private_cb'