当前位置: 首页>>代码示例>>Python>>正文


Python Snapshot.get_by_search_type方法代码示例

本文整理汇总了Python中pyasm.biz.Snapshot.get_by_search_type方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_by_search_type方法的具体用法?Python Snapshot.get_by_search_type怎么用?Python Snapshot.get_by_search_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.biz.Snapshot的用法示例。


在下文中一共展示了Snapshot.get_by_search_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_display

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_search_type [as 别名]
    def get_display(my):

        web = WebContainer.get_web()
        search_key = web.get_form_value("search_key")

        widget = Widget()

        sobject = Search.get_by_search_key(search_key)

        table = TableWdg( sobject.get_search_type(), "render" )
        table.set_sobject(sobject)
        widget.add(table)



        # get all of the snapshots with a context render
        sobject_snapshot = Snapshot.get_latest_by_sobject(sobject,"render")
        if sobject_snapshot:
            search_type = sobject.get_search_type()
            search_id = sobject.get_value('search_id')
            
            render_snapshots = Snapshot.get_by_search_type(search_type,search_id,"render")

            table = TableWdg("sthpw/snapshot")
            table.set_sobjects(render_snapshots)
            widget.add(table)



        widget.add(HtmlElement.h3("Rendered Frames"))
        if sobject_snapshot:
            widget.add("Render version: v%0.3d" % sobject_snapshot.get_value("version") )

        # get latest snapshot of the render
        renders = Render.get_all_by_sobject(sobject)
        if not renders:
            widget.add("<h4>No renders found</h4>")
            return widget

        render = renders[0]
        snapshot = Snapshot.get_latest_by_sobject(render,"render")
        if snapshot == None:
            widget.add("<h4>No snapshots found</h4>")
            return widget


        # get the images
        web_dir = snapshot.get_web_dir()
        lib_dir = snapshot.get_lib_dir()

        xml = snapshot.get_xml_value("snapshot")
        file_nodes = xml.get_nodes("snapshot/file")
        file_name = icon_file_name = ''
        frame_range = icon_frame_range = None
        
        for file_node in file_nodes: 
            if Xml.get_attribute(file_node, 'type') == 'main':
                file_name, frame_range = my._get_frame_info(file_node, sobject)
            if Xml.get_attribute(file_node, 'type') == 'icon':
                icon_file_name, icon_frame_range = my._get_frame_info(file_node, sobject)
            
        file_names = [file_name]
        icon_file_names = [icon_file_name]        

        if "##" in file_name:
            file_names = FileGroup.expand_paths(file_name, frame_range)
        if "##" in icon_file_name:
            icon_file_names = FileGroup.expand_paths(icon_file_name, \
                icon_frame_range)    
        
        div = DivWdg()
        for k in range(len(file_names)):
            file_name = file_names[k]

            # ignore frames that don't exist
            lib_path = "%s/%s" % (lib_dir, file_name)
            if not os.path.exists(lib_path):
                continue
           
            try:
                icon_file_name = icon_file_names[k]
            except IndexError:
                icon_file_name = file_names[k]
                
            file_path = "%s/%s" % (web_dir, file_name)
            icon_file_path = "%s/%s" % (web_dir, icon_file_name)
            
            img = HtmlElement.img(icon_file_path)
            img.set_attr("width", "60")
            img.add_event("onmouseover","hint_bubble.show(event,'Ctrl + Click to open in new window')")

            href = HtmlElement.href(img, file_path)
            div.add(href)

        widget.add(div)

        widget.add( "<h3>Render History</h3>" )
        widget.add( my.get_render_history(renders) )

        return widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:102,代码来源:frame_info_wdg.py


注:本文中的pyasm.biz.Snapshot.get_by_search_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。