本文整理汇总了Python中pyasm.biz.Snapshot.get_snapshot方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_snapshot方法的具体用法?Python Snapshot.get_snapshot怎么用?Python Snapshot.get_snapshot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Snapshot
的用法示例。
在下文中一共展示了Snapshot.get_snapshot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_path_from_sobject
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_snapshot [as 别名]
def get_path_from_sobject(my, sobject):
icon_path = None
path = None
search_type = sobject.get_search_type()
search_code = sobject.get_value("code", no_exception=True)
if not search_code:
search_code = sobject.get_id()
# FIXME: make this faster
snapshot = Snapshot.get_snapshot(search_type, search_code, context='icon')
if not snapshot:
snapshot = Snapshot.get_snapshot(search_type, search_code, context='publish')
if not snapshot:
snapshot = Snapshot.get_snapshot(search_type, search_code, process='publish')
if not snapshot:
snapshot = Snapshot.get_snapshot(search_type, search_code)
if snapshot:
file_type = "web"
icon_path = snapshot.get_web_path_by_type(file_type)
file_type = "main"
path = snapshot.get_web_path_by_type(file_type)
if icon_path:
path = icon_path
elif path:
path = my.find_icon_link(path)
return path
示例2: get_path_from_sobject
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_snapshot [as 别名]
def get_path_from_sobject(my, sobject):
icon_path = None
path = None
base_search_type = sobject.get_base_search_type()
if base_search_type == "sthpw/snapshot":
#sobject = sobject.get_parent()
snapshot = sobject
else:
search_type = sobject.get_search_type()
search_code = sobject.get_value("code", no_exception=True)
if not search_code:
search_code = sobject.get_id()
# FIXME: make this faster
snapshot = Snapshot.get_snapshot(search_type, search_code, process=['icon','publish',''])
if snapshot:
file_type = "web"
icon_path = snapshot.get_web_path_by_type(file_type)
file_type = "main"
path = snapshot.get_web_path_by_type(file_type)
if icon_path:
path = icon_path
elif path:
path = my.find_icon_link(path)
return path
示例3: get_bottom
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_snapshot [as 别名]
def get_bottom(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')
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|%s] context [%s] not found" %(search_type, search_id, 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.PREFIX
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('%s','%s')'''
% (prefix, my.REF_CB_NAME)})
div.add( SpanWdg(update_button, css='small'))
return div