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


Python Snapshot.get_by_sobjects方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_sobjects [as 别名]
    def get_display(self):
        sobject = self.get_current_sobject()

        snapshots = []
        if isinstance(sobject, Layer):
            # for layer renders, we try to get all render sobjects
            renders = Render.get_all_by_sobject(sobject)
            if renders:
                snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
        else: # for object that has direct snapshots like plates
            snapshot = Snapshot.get_current_by_sobject(sobject)
            if snapshot:
                snapshots.append(snapshot)

        if not snapshots:
            return "<i>- no files -</i>"

        div = DivWdg()

        for snapshot in snapshots:
            file_types = snapshot.get_all_file_types()
            table = Table(css='embed')

            for file_type in file_types:
                table.add_row()
                
                table.add_cell( self.get_open_wdg(snapshot, file_type) )
                dir = snapshot.get_client_lib_dir(file_type=file_type)
                
                
                table.add_cell( "%s: <i>%s</i>" % (file_type, dir) )
         

            div.add(table)
        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:37,代码来源:composite_wdg.py

示例2: get_paths

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_sobjects [as 别名]
    def get_paths(self, file_type='main'):

        # this is the selected one
        search_key = self.kwargs.get("search_key")
      
        search_keys = self.kwargs.get("search_keys")
        paths = self.kwargs.get("paths")

        if not paths:
            paths = []


        if search_keys:
            sobjects = Search.get_by_search_keys(search_keys, keep_order=True)

            # return_dict=True defaults to return the first of each snapshot list 
            # and so works well with is_latest=True
            if sobjects and sobjects[0].get_base_search_type() == "sthpw/snapshot":
                sobj_snapshot_dict = {}
                for sobject in sobjects:
                    tmp_search_key = sobject.get_search_key()
                    sobj_snapshot_dict[tmp_search_key] = sobject
                snapshots = sobjects

            else:
                sobj_snapshot_dict = Snapshot.get_by_sobjects(sobjects, is_latest=True, return_dict=True)

                snapshots = sobj_snapshot_dict.values()

            file_dict = Snapshot.get_files_dict_by_snapshots(snapshots, file_type=file_type)
            for sobject in sobjects:
                path = ''
                snapshot = sobj_snapshot_dict.get(sobject.get_search_key())
                # it is supposed to get one (latest), just a precaution
                if isinstance(snapshot, list):
                    snapshot = snapshot[0]
                if not snapshot:
                    continue

                file_list = file_dict.get(snapshot.get_code())
                if not file_list: 
                    paths.append("")
                    continue


               
                # NOTE: there should only be one file
                tmp_paths = []
                for file_object in file_list:
                    path = file_object.get_web_path()

                    if path.find("#") != -1:
                        expanded_paths = snapshot.get_expanded_web_paths()
                        path = "|".join(expanded_paths)

                    tmp_paths.append(path)  

                path = "|".join(tmp_paths)
                self.sobject_data[path] = sobject
                paths.append(path)

	            # set the current path the user clicks on
                if not self.curr_path and sobject.get_search_key() == search_key and file_type=='main':
                    self.curr_path = path
                        

        elif paths:
            return paths

        else:
            # TEST
            paths = [
                '/assets/test/store/The%20Boxter_v001.jpg',
                '/assets/test/store/Another%20one_v001.jpg',
                '/assets/test/store/Whatever_v001.jpg'
            ]

        """
        for index,path in enumerate(paths):
            path = urllib.pathname2url(path)
            paths[index] = path
        """

        return paths
开发者ID:mincau,项目名称:TACTIC,代码行数:86,代码来源:gallery_wdg.py

示例3: get_paths

# 需要导入模块: from pyasm.biz import Snapshot [as 别名]
# 或者: from pyasm.biz.Snapshot import get_by_sobjects [as 别名]
    def get_paths(my, file_type='main'):

        # this is the selected one
        search_key = my.kwargs.get("search_key")
      
        search_keys = my.kwargs.get("search_keys")
        paths = my.kwargs.get("paths")

        if not paths:
            paths = []
        """
        if search_keys:
            sobjects = Search.get_by_search_keys(search_keys)
            snapshots = Snapshot.get_by_sobjects(sobjects, is_latest=True)
            file_objects = File.get_by_snapshots(snapshots, file_type='main')
            paths = [x.get_web_path() for x in file_objects]

            web_file_objects = File.get_by_snapshots(snapshots, file_type='web')
            web_paths = [x.get_web_path() for x in web_file_objects]
            #paths = web_paths

            for sobject, path in zip(sobjects, paths):
                my.sobject_data[path] = sobject
        """
        if search_keys:
            sobjects = Search.get_by_search_keys(search_keys, keep_order=True)

            # return_dict=True defaults to return the first of each snapshot list 
            # and so works well with is_latest=True
            if sobjects and sobjects[0].get_base_search_type() == "sthpw/snapshot":
                sobj_snapshot_dict = {}
                for sobject in sobjects:
                    tmp_search_key = sobject.get_search_key()
                    sobj_snapshot_dict[tmp_search_key] = sobject
                snapshots = sobjects

            else:
                sobj_snapshot_dict = Snapshot.get_by_sobjects(sobjects, is_latest=True, return_dict=True)

                snapshots = sobj_snapshot_dict.values()

            file_dict = Snapshot.get_files_dict_by_snapshots(snapshots, file_type=file_type)

            for sobject in sobjects:
                path = ''
                snapshot = sobj_snapshot_dict.get(sobject.get_search_key())
                # it is supposed to get one (latest), just a precaution
                if isinstance(snapshot, list):
                    snapshot = snapshot[0]
                if not snapshot:
                    continue

                file_list = file_dict.get(snapshot.get_code())
                if not file_list: 
                    continue
                
                for file_object in file_list:
                    path = file_object.get_web_path()
                    my.sobject_data[path] = sobject
                    paths.append(path)  
	            # set the current path the user clicks on
                if not my.curr_path and sobject.get_search_key() == search_key and file_type=='main':
                    my.curr_path = path
                        

        elif paths:
            return paths

        else:
            # TEST
            paths = [
                '/assets/test/store/The%20Boxter_v001.jpg',
                '/assets/test/store/Another%20one_v001.jpg',
                '/assets/test/store/Whatever_v001.jpg'
            ]

        return paths
开发者ID:nuxping,项目名称:TACTIC,代码行数:79,代码来源:gallery_wdg.py


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