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


Python Snapshot.get_latest方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_latest [as 别名]
    def get_display(my):
        top = DivWdg()
        top.add_class("spt_visual_notes_top")

        my.search_key = my.kwargs.get("search_key")
        my.context = my.kwargs.get("context")
        assert my.search_key
        assert my.context


        sobject = Search.get_by_search_key(my.search_key)
        sobj_search_type = sobject.get_search_type()
        sobj_id = sobject.get_id()
        assert sobject

        snapshot = Snapshot.get_latest(sobj_search_type, sobj_id, my.context)
        if not snapshot:
            my.path = ''
            top.add("<b>No snapshot found</b>")
            return top
        else:
            files = snapshot.get_files_by_type("main")
            
            file = files[0]
            my.path = "/assets/%s/%s" % (file.get_value("relative_dir"), file.get_value("file_name") )

            #my.path = "/assets/cg/asset/chr/chr001/icon/hawaii01_web_icon_v001.jpg"


        my.note_context = my.context + '|note'


        # put in a title
        title_div = DivWdg()
        title_div.add_class("maq_search_bar")
        title_div.add("Visual Notes Editor")
        top.add(title_div)


        # add in the buttons bar
        buttons_wdg = my.get_buttons_wdg()
        top.add(buttons_wdg)




        flash_vars = "file=" + my.path;

        #'swf_url': '/assets/sthpw/widget/visual_notes_wdg/VisualNotesWdg.swf',
        kwargs = {
              'swf_url': '/context/visual_notes_wdg.swf',
              'title': 'Flash Test',
              'flash_vars': flash_vars,
              'width': '800',
              'height': '600'
        }
        #spt.panel.load('spt_flash', 'tactic.ui.panel.SwfWdg', kwargs);

        from tactic.ui.panel import SwfWdg
        swf = SwfWdg(**kwargs)
        top.add(swf)


        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:66,代码来源:visual_notes_wdg.py

示例2: handle_contents

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_latest [as 别名]
    def handle_contents(self, set):

        self.add(HtmlElement.br())
        
        # get all of the reference nodes
        snapshot = Snapshot.get_latest_by_sobject(set, "publish")
        if snapshot == None:
            self.add(HtmlElement.h3("No Contents"))
            return

        snapshot_xml = snapshot.get_xml_value("snapshot")
        ref_nodes = snapshot_xml.get_nodes("snapshot/ref")

        nav = ItemsNavigatorWdg(self.ITEMS_NAV_LABEL, \
            len(ref_nodes), self.MAX_ITEMS_PER_PAGE)
        items_range = nav.get_value()
        self.add(nav)
        
        introspect = IntrospectWdg()
        introspect.add_style('padding-bottom: 3px')
        self.add(introspect)
       
        
        # get the contents in the introspection
        session = SessionContents.get()
     
        
        start, end = 1 , self.MAX_ITEMS_PER_PAGE
        try:
            start, end = items_range.split("-")
        except Exception:
            pass    
        
        ref_nodes = ref_nodes[int(start)-1 : int(end)]
        sobjects = []
        info = []
        for node in ref_nodes:
            search_type = Xml.get_attribute(node,"search_type")
            search_id = Xml.get_attribute(node,"search_id")
            instance = Xml.get_attribute(node,"instance")
            version = Xml.get_attribute(node,"version")
            latest_context = Xml.get_attribute(node,"context")
            
            # get the latest snapshot
            #TODO: this query can be optimized
            
            latest = Snapshot.get_latest(search_type, search_id, \
                latest_context)
            if latest == None:
                latest_version = 0
            else:
                latest_version = latest.get_value("version")

            # add an icon
            if latest != None:
                sobject = latest.get_sobject()
            else:
                sobject = None
            session_version = session.get_version(instance)
            session_context = session.get_context(instance)

            sobjects.append(sobject)
            info.append({'session_version': session_version, \
                'session_context': session_context,  \
                'latest_context': latest_context, \
                'latest_version': latest_version, 'instance': instance})
        
        table = TableWdg('prod/asset','set_items')
        table.set_sobjects(sobjects)
        table.set_aux_data(info)
   
        self.add(table)
开发者ID:mincau,项目名称:TACTIC,代码行数:74,代码来源:maya_set_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_latest [as 别名]
    def get_display(self):
        
        if self.mode == 'detail':
            upstream = True
            div = DivWdg()
            self.snapshot_code = self.kwargs.get('snapshot_code')
            ref_snapshot = Snapshot.get_by_code(self.snapshot_code)
            self._handle_snapshot(ref_snapshot, div, upstream, recursive=False)
            return div


        self.web = WebContainer.get_web()

        if self.sobjects:
            snapshot = self.sobjects[0]
        else:
            search_type = self.kwargs.get("search_type")
            search_id = self.kwargs.get("search_id")

            snapshot = None
            if search_type == Snapshot.SEARCH_TYPE:
                snapshot = Search.get_by_id(search_type, search_id)
            else:
                snapshot = Snapshot.get_latest(search_type, search_id)
        if not snapshot:
            self.add(HtmlElement.h3("No snapshot found"))
            return super(DependencyWdg,self).get_display()



        widget = DivWdg()
        widget.add_style('min-width: 700px')
        
      
        if self.show_title:
            self.add(HtmlElement.h3("Asset Dependency"))

        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(search_type="sthpw/snapshot", mode='simple', view='table', width='700px')
        table.add_style('min-width: 700px')
        table.set_sobject(snapshot)
        widget.add(table)


        sobject = snapshot.get_sobject()
        search_type_obj = sobject.get_search_type_obj()

        #file_div = DivWdg(css='left_content discussion_child')
        file_div = DivWdg()
        file_div.add_color("background", "background", -20)
        file_div.add_color("color", "color")
        file_div.add_style("padding: 5px")
        file_div.add_border()




        #file_div.add_style('margin','0 10px 0 10px')
        file_div.add_style('padding','10px 0 0 10px')
        #file_div.add_style('-moz-border-radius: 6px')
        title = DivWdg()
        title.add_style("font-weight: bold")
        title.add_style("font-size: 1.2em")
        #title.add_style('margin-left', '10px')

        if self.show_title:
            title.add(search_type_obj.get_title() )
            title.add(" - ")
            title.add(sobject.get_code() )
            if sobject.has_value("description"):
                title.add(" : ")
                title.add(sobject.get_value("description") )

            file_div.add(title)
            file_div.add(HtmlElement.br())

        # find out how many 1st level ref nodes we are dealing with
        xml = snapshot.get_xml_value("snapshot")
        
        #self.total_ref_count = len(xml.get_nodes("snapshot/file/ref | snapshot/ref |snapshot/input_ref| snapshot/fref"))

        self._handle_snapshot(snapshot, file_div, upstream=True, recursive=True )
        self._handle_snapshot(snapshot, file_div,  upstream=False, recursive=True )

        #widget.add(widget)
        widget.add(file_div)
        widget.add(HtmlElement.br(2))

        #return super(DependencyWdg,self).get_display()
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:92,代码来源:dependency_wdg.py


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