本文整理汇总了Python中pyasm.biz.Snapshot.get_by_version方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_by_version方法的具体用法?Python Snapshot.get_by_version怎么用?Python Snapshot.get_by_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.biz.Snapshot
的用法示例。
在下文中一共展示了Snapshot.get_by_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handle_ref_node
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_version [as 别名]
def _handle_ref_node(self, node, widget, upstream=False, recursive=True):
# get the reference snapshot (should maybe use the loader or
# at least share the code
instance = Xml.get_attribute(node,"instance")
search_type = Xml.get_attribute(node,"search_type")
search_id = Xml.get_attribute(node,"search_id")
context = Xml.get_attribute(node,"context")
version = Xml.get_attribute(node,"version")
# this is often the Maya file node name or XSI long clip name
node_name = Xml.get_attribute(node, "node")
my_name = Xml.get_node_name(node)
# get the snapshot
ref_snapshot = Snapshot.get_by_version(search_type, search_id,\
context, version)
#ref_snapshot = Snapshot.get_latest(search_type,search_id, context)
if ref_snapshot == None:
widget.add("|---> <font color='red'>Error: No reference found for [%s, %s, %s]</font>" % \
(search_type, search_id, context) )
return
toggle_id = self.generate_unique_id('toggle')
widget.add(FloatDivWdg(), toggle_id)
version = ref_snapshot.get_value("version")
try:
sobject = ref_snapshot.get_sobject()
except SObjectNotFoundException, e:
widget.add('[%s|%s] may have been deleted or is not viewable.' % (ref_snapshot.get_value('search_type'),\
ref_snapshot.get_value('search_id')))
return
示例2: add_ending
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_version [as 别名]
def add_ending(self, parts, auto_version=True):
context = self.snapshot.get_value("context")
filename = self.file_object.get_full_file_name()
# make sure that the version in the file name does not yet exist
version = self.get_version_from_file_name(filename)
if not auto_version and version:
# if the file version is not the same as the snapshot version
# then check to see if the snapshot already exists
if not context.startswith("cache") and version != self.snapshot.get_value("version"):
existing_snap = Snapshot.get_by_version(self.snapshot.get_value("search_type"),\
self.snapshot.get_value("search_id"), context, version)
if existing_snap:
raise TacticException('A snapshot with context "%s" and version "%s" already exists.' % (context, version) )
self.snapshot.set_value("version", version)
self.snapshot.commit()
else:
version = self.snapshot.get_value("version")
if version == 0:
version = "CURRENT"
elif version == -1:
version = "LATEST"
else:
version = "v%0.3d" % int(version)
revision = self.snapshot.get_value("revision", no_exception=True)
if revision:
revision = "r%0.2d" % int(revision)
ext = self.get_ext()
parts.append(context.replace("/", "_"))
if self.is_tactic_repo():
parts.append(version)
if revision:
parts.append(revision)
# should all files be named with file_type ending?
file_type = self.get_file_type()
# backwards compatibility
if file_type and file_type not in ['maya','main','geo','xml']:
parts.append(file_type)
#if file_type in ['web','icon']:
# parts.append(file_type)
value = ProdSetting.get_value_by_key("naming/add_initials")
if value == "true":
project = Project.get()
initials = Project.get().get_initials()
if initials:
parts.append(initials)
filename = "_".join(parts)
if ext:
filename = "%s%s" % (filename, ext)
return filename
示例3: init
# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_version [as 别名]
def init(my):
WebContainer.register_cmd("pyasm.widget.AnnotateCbk")
sobject = my.get_current_sobject()
if not sobject:
if not my.__dict__.has_key("search_type"):
web = WebContainer.get_web()
my.search_type = web.get_form_value("search_type")
my.search_id = web.get_form_value("search_id")
if not my.search_type:
my.add("No search type")
return
search = Search(my.search_type)
search.add_id_filter(my.search_id)
sobject = search.get_sobject()
snapshot = Snapshot.get_latest_by_sobject(sobject)
# TODO:
# this is a bit klunky
snapshot_xml = snapshot.get_xml_value("snapshot")
file_code = snapshot_xml.get_value("snapshot/file[@type='web']/@file_code")
file = File.get_by_code(file_code)
web_dir = snapshot.get_web_dir()
path = "%s/%s" % (web_dir, file.get_full_file_name() )
# add the annotate js object
script = HtmlElement.script("annotate = new Annotate()")
my.add(script)
# add the image
my.add("<h3>Image Annotations</h3>")
width = 600
img = HtmlElement.img(path)
img.add_style("position: absolute")
img.set_id("annotate_image")
img.add_style("left: 0px")
img.add_style("top: 0px")
img.add_style("opacity: 1.0")
img.add_style("z-index: 1")
img.add_style("width", width)
img.add_event("onmouseup", "annotate.add_new(event)")
my.add(img)
# test
version = snapshot.get_value("version")
if version != 1:
last_version = version - 1
snapshot = Snapshot.get_by_version( \
my.search_type, my.search_id, version=last_version )
snapshot_xml = snapshot.get_xml_value("snapshot")
file_code = snapshot_xml.get_value("snapshot/file[@type='web']/@file_code")
file = File.get_by_code(file_code)
web_dir = snapshot.get_web_dir()
path = "%s/%s" % (web_dir, file.get_full_file_name() )
img = HtmlElement.img(path)
img.set_id("annotate_image_alt")
img.add_style("position: absolute")
img.add_style("left: 0px")
img.add_style("top: 0px")
img.add_style("opacity: 1.0")
img.add_style("z-index: 0")
img.add_style("width", width)
img.add_event("onmouseup", "annotate.add_new(event)")
my.add(img)
#script = HtmlElement.script("align_element('%s','%s')" % \
# ("annotate_image", "annotate_image_alt") )
#my.add(script)
div = DivWdg()
div.add_style("position: absolute")
div.add_style("left: 620")
div.add_style("top: 300")
my.add(div)
button = IconButtonWdg("Switch", IconWdg.REFRESH, True)
button.add_event("onclick", "annotate.switch_alt()")
div.add(button)
button = IconButtonWdg("Opacity", IconWdg.LOAD, True)
button.add_event("onclick", "annotate.set_opacity()")
div.add(button)
#.........这里部分代码省略.........