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


Python Search.add_sobject_filter方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]
    def get_display(self):

        sobject = self.get_current_sobject()
        sobject = sobject.get_parent()
        if not sobject:
            return Widget()

        # get all of the sobject_logs
        search = Search("sthpw/sobject_log")
        search.add_sobject_filter(sobject)
        logs = search.get_sobjects()

        search = Search("sthpw/transaction_log")
        search.add_filters("id", [x.get_value("transaction_log_id") for x in logs] )
        search.set_limit(200)
        logs = search.get_sobjects()
        
        from layout_wdg import TableWdg
        widget = Widget()
        table = TableWdg("sthpw/transaction_log")
        table.add_class("minimal")
        table.set_header_flag(False)
        table.set_show_property(False)
        table.set_no_results_wdg( " " )
        table.set_sobjects(logs)
        widget.add(table)
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:29,代码来源:clipboard_wdg.py

示例2: get_display

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

        path = my.kwargs.get("path")
        md5 = my.kwargs.get("md5")
        snapshot_code = my.kwargs.get("snapshot_code")

        top = my.top
        top.add_style("padding: 10px")
        top.add_color("background", "background", -5)

        path_div = DivWdg()
        top.add(path_div)
        path_div.add("<b>Local Path: %s</b><br/>" % path)
        path_div.add_style("font-size: 12px")
        path_div.add_style("margin-bottom: 10px")

        info_wdg = DivWdg()
        info_wdg.add_color("background", "background3")
        top.add(info_wdg)
        info_wdg.add("md5: %s<br/>" % md5)
        info_wdg.add("snapshot_code: %s<br/>" % snapshot_code)
        info_wdg.add_style("padding: 5px")


        search_key = my.kwargs.get("search_key")
        sobject = Search.get_by_search_key(search_key)


        # bit of a hack get the file system paths
        #spath = Common.get_filesystem_name(path)
        spath = path.replace(" ", "_")
        search = Search("sthpw/file")
        search.add_sobject_filter(sobject)
        search.add_filter("source_path", spath)
        search.add_order_by("timestamp desc")
        files = search.get_sobjects()

        '''
        files_div = DivWdg()
        files_div.add_style("margin: 5px")
        files_div.add_style("padding: 5px")
        files_div.add_border()

        top.add(files_div)
        '''
        snapshots = []
        for file in files:
            snapshot = file.get_parent()
            snapshots.append(snapshot)

        from tactic.ui.panel import StaticTableLayoutWdg
        table = StaticTableLayoutWdg(search_type="sthpw/snapshot", view="table", show_shelf=False)
        table.set_sobjects(snapshots)
        top.add(table)



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

示例3: create

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]
    def create(src_sobject, dst_sobject, context="reference", direction="both"):

        project_code = Project.get_project_code()

        if not context:
            context = "reference"

        # ensure that the connection doesn't already exist
        search = Search("sthpw/connection")
        search.add_sobject_filter(src_sobject, prefix="src_")
        search.add_sobject_filter(dst_sobject, prefix="dst_")
        if search.get_count():
            Environment.add_warning("Already connected", "%s is already connected to %s" % (src_sobject.get_code(), dst_sobject.get_code() ) )
            return


        connection = SearchType.create("sthpw/connection")
        connection.set_value("src_search_type", src_sobject.get_search_type() )
        connection.set_value("dst_search_type", dst_sobject.get_search_type() )
        connection.set_value("src_search_id", src_sobject.get_id() )
        connection.set_value("dst_search_id", dst_sobject.get_id() )
        connection.set_value("context", context)
        connection.set_value("project_code", project_code)
        connection.commit()

        if direction == "both":
            connection = SearchType.create("sthpw/connection")
            connection.set_value("src_search_type", dst_sobject.get_search_type() )
            connection.set_value("dst_search_type", src_sobject.get_search_type() )
            connection.set_value("src_search_id", dst_sobject.get_id() )
            connection.set_value("dst_search_id", src_sobject.get_id() )
            connection.set_value("context", context)
            connection.set_value("project_code", project_code)
            connection.commit()


        return connection
开发者ID:blezek,项目名称:TACTIC,代码行数:39,代码来源:sobject_connection.py

示例4: _get_sobject_search

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]
 def _get_sobject_search(my, sobject, search_type):
     ''' get the search for this sobject and search_type '''
     if search_type.startswith("sthpw/connection"):
         search = Search(search_type)
         search.add_sobject_filter(sobject,"src_")
         if sobject.get_base_search_type() == 'prod/shot':
             search.add_filter('context', 'reference')
     elif search_type.startswith("sthpw/"):
         search = Search(search_type)
         search.add_sobject_filter(sobject)
     elif search_type.startswith("prod/render"):
         search = Search(search_type)
         search.add_sobject_filter(sobject)
     elif search_type.startswith("internal/support_email"):
         search = Search(search_type)
         search.add_filter("ticket_code", sobject.get_id() )
     else:
         search = Search(search_type)
         search.add_filter( sobject.get_foreign_key(), sobject.get_code() )
     return search
开发者ID:0-T-0,项目名称:TACTIC,代码行数:22,代码来源:asset_detail_wdg.py

示例5: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]
    def preprocess(my):
        # find out if there is a snapshot associated with this path
        #print "sobject: ", my.sobject

        #context = "design/%s" % basename
        #search = Search("sthpw/snapshot")
        #search.add_filter("context", context)
        #my.sobject = search.get_sobject()

        search_key = my.kwargs.get("search_key")
        my.sobject = Search.get_by_search_key(search_key)

        md5s = my.kwargs.get("md5s")
        sizes = my.kwargs.get("sizes")

        # bit of a hack get the file system paths
        spaths = []
        my.md5s = {}
        my.sizes = {}
        for i, path in enumerate(my.paths):
            #path = Common.get_filesystem_name(path)
            #new_path = path.replace(" ", "_")
            new_path = path
            spaths.append(new_path)

            my.md5s[new_path] = md5s.get(path)
            my.sizes[new_path] = sizes.get(path)


        process = my.kwargs.get("process")

        # need to match up files 
        search = Search("sthpw/file")
        search.add_sobject_filter(my.sobject)
        snapshots = []
        if process:
            search2 = Search("sthpw/snapshot")
            search2.add_filter("process", process)
            search2.add_filter("is_latest", True)
            search2.add_sobject_filter(my.sobject)
            snapshots = search2.get_sobjects()
            search.add_relationship_search_filter(search2)
        #search.add_filters("source_path", spaths)
        sobjects = search.get_sobjects()

        my.snapshots_dict = {}
        for snapshot in snapshots:
            my.snapshots_dict[snapshot.get_code()] = snapshot


        my.base_dir = my.kwargs.get("base_dir")
        my.checked_in_paths = {}
        for sobject in sobjects:
            source_path = sobject.get_value("source_path")
            if not source_path:
                print "WARNING: source_path for file [%s] is empty" % sobject.get_code()
                continue
            my.checked_in_paths[source_path] = sobject

            relative_dir = sobject.get_value("relative_dir")
            file_name = sobject.get_value("file_name")
            file_name = os.path.basename(source_path)
            relative_path = "%s/%s" % (relative_dir, file_name)

            sandbox_dir = Environment.get_sandbox_dir()
            sandbox_path = "%s/%s" % (sandbox_dir, relative_path)
            my.checked_in_paths[sandbox_path] = sobject



        # this is advanced option
        my.context_options = my.kwargs.get("context_options")

        my.subcontext_options = my.kwargs.get("subcontext_options")
        if not my.subcontext_options:
            my.subcontext_options = []


        my.preselected = my.kwargs.get("preselected")
开发者ID:lucasnemeth,项目名称:TACTIC,代码行数:81,代码来源:checkin_dir_list_wdg.py

示例6: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]

#.........这里部分代码省略.........
        td.add_style("border-right: solid 1px")
       
        # notes
        title = DivWdg()
        title.add_class("maq_search_bar")
        x = DivWdg("[x]")
        x.add_style("float: right")
        title.add(x)
        title.add("Notes")
        td.add(title)
        discussion_wdg = DiscussionWdg()
        discussion_wdg.preprocess()
        discussion_wdg.set_sobject(sobject)
        td.add(discussion_wdg)

        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding-left: 5px")
        td.add_style("border-right: solid 1px")
 

        # tasks
        title = DivWdg()
        title.add_class("maq_search_bar")
        x = DivWdg("[x]")
        x.add_style("float: right")
        title.add(x)
        title.add("Custom Properties")
        td.add(title)
        search = Search("prod/custom_property")
        search.add_filter("search_type", "sample3d/book")
        sobjects = search.get_sobjects()
        table = TableLayoutWdg(search_type="prod/custom_property", view='table')
        table.set_sobjects(sobjects)
        td.add(table)

        div.add(HtmlElement.hr())
        div.add(HtmlElement.br(clear="all"))





        title_wdg = DivWdg()
        title_wdg.add_class("maq_search_bar")
        x = DivWdg("[x]")
        x.add_style("float: right")
        title_wdg.add(x)
        #title_wdg.add_style("font-size: 1.5em")
        title_wdg.add("Detail" )
        div.add(title_wdg)
        div.add(HtmlElement.br())



        # TEST getting schema
        search_type = sobject.get_base_search_type()
        schema = Schema.get_by_sobject(sobject)

        



        # add a second table
        table = Table()
        table.set_max_width()


        # show the snapshots for this sobject
        search_type = "sthpw/snapshot"
        search = Search(search_type)
        search.add_sobject_filter(sobject)
        search.set_limit(50)
        sobjects = search.get_sobjects()


        table.add_row()
        nav_td = table.add_cell()
        nav_td.add_style("width: 100px")
        nav_td.add_style("vertical-align: top")
        #section_wdg = my.get_section_wdg(sobject)
        #nav_td.add( section_wdg )

        #from tactic.ui.panel import ManageViewPanelWdg
        #defined = ManageViewPanelWdg()
        from tactic.ui.panel import ManageViewWdg
        defined = ManageViewWdg()
        nav_td.add(defined)

        #content_wdg = TableLayoutWdg(search_type=search_type, view='table')
        #content_wdg.set_sobjects(sobjects)
        #content_td = table.add_cell()
        #content_td.set_id("sobject_relation")
        #content_td.add_style("display: table-cell")
        #content_td.add_style("vertical-align: top")
        #content_td.add(content_wdg)

        div.add(table)

        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:104,代码来源:search_type_panel_wdg.py

示例7: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]

#.........这里部分代码省略.........
            bvr2.options = options;
            bvr2.values = values;
            bvr2.args = args;
            spt.popup.get_widget({}, bvr2)

            */

            '''
        } )


        button_div = DivWdg()
        content.add(button_div)
        button = IconWdg(title="Check-Out", icon=IconWdg.CHECK_OUT_3D_LG)
        button_div.add(button)
        button_div.set_box_shadow("1px 1px 1px 1px")
        button_div.add_style("width: 60px")
        button_div.add_style("height: 60px")
        button_div.add_style("float: left")
        button_div.add_style("margin: 20px")
        button_div.add_style("padding: 2px 3px 0 0")
        button_div.add_style("background: white")
        button_div.add_class("hand")

        button_div.add_style("text-align: center")
        button_div.add("Check-out")

       
        sobject = SearchKey.get_by_search_key(search_key)

        # snapshot is retrieved for getting the process informatoin, they are not being used
        # for loading as real_time snapshot query option is used. 
        search = Search("sthpw/snapshot")
        search.add_sobject_filter(sobject)
        if my.process:
            search.add_filter("process", my.process)
        search.add_filter("is_latest", True)
        snapshot = search.get_sobject()

        if not my.process and snapshot:
            my.process = snapshot.get_value('process')
            # for old process-less snapshots
            if not my.process:
                my.process = snapshot.get_value('context')

        process_wdg = DivWdg(HtmlElement.b(checkin_process))
        if checkin_process:
            width = len(checkin_process)*10
        else:
            width = 10
        process_wdg.add_styles('margin-left: auto; margin-right: auto; text-align: center; width: %s'%width)
        process_div.add(process_wdg)
        # DO NOT pass in snapshot_code, get it in real time

        snapshot_codes = []
   
        show_status = True
        if my.checkout_action == 'latest':
            cbjs_action = CheckinSandboxListWdg.get_checkout_cbjs_action(my.process, show_status)
            bvr = {'snapshot_codes': snapshot_codes,
                    'real_time': True,
                    'file_types': ['main'],
                    'filename_mode': 'repo',
                    'cbjs_action': cbjs_action}

        elif my.checkout_action == 'latest (version_omitted)':
开发者ID:0-T-0,项目名称:TACTIC,代码行数:70,代码来源:simple_checkin_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_sobject_filter [as 别名]

#.........这里部分代码省略.........
        # tasks
        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("padding-left: 5px")
        td.add_style("border-right: solid 1px")
        title = DivWdg()
        title.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title.add(x)
        title.add("Tasks")
        td.add(title)
        task_wdg = SObjectTaskTableElement()
        task_wdg.set_sobject(sobject)
        td.add(task_wdg)
        td.add_style('cell-padding','10')


        # discussion
        td = table.add_cell()
        #td.add_style("min-width: 300px")
        #td.add_style("width: 600px")
        td.add_style("vertical-align: top")
        td.add_style("padding-left: 5px")
        td.add_style("border-right: solid 1px")
       
        title = DivWdg()
        title.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title.add(x)
        title.add("Notes")
        td.add(title)
        discussion_wdg = DiscussionWdg()
        discussion_wdg.preprocess()
        discussion_wdg.set_sobject(sobject)
        td.add(discussion_wdg)
        note_panel = discussion_wdg.get_note_menu()
        td.add(note_panel)

        div.add(table)
       

        div.add(HtmlElement.hr())
        div.add(HtmlElement.br(clear="all"))

        title_wdg = DivWdg()
        title_wdg.add_class("maq_search_bar")
        #x = DivWdg("[x]")
        #x.add_style("float: right")
        #title_wdg.add(x)
        #title_wdg.add_style("font-size: 1.5em")
        title_wdg.add("Detail" )
        div.add(title_wdg)
        div.add(HtmlElement.br())



        # TEST getting schema
        search_type = sobject.get_base_search_type()
        schema = Schema.get_by_sobject(sobject)
        child_types = schema.get_child_types(search_type)




        # add a second table
        table = Table()
        table.set_max_width()


        # show the snapshots for this sobject
        search_type = "sthpw/snapshot"
        search = Search(search_type)
        search.add_sobject_filter(sobject)
        search.set_limit(25)
        sobjects = search.get_sobjects()


        table.add_row()
        nav_td = table.add_cell()
        nav_td.add_style("width: 100px")
        nav_td.add_style("vertical-align: top")
        section_wdg = my.get_section_wdg(sobject)
        nav_td.add( section_wdg )

        parent_key = SearchKey.get_by_sobject(sobject)
        content_wdg = ViewPanelWdg(search_type=search_type, element_name='Snapshots', \
            title='Snapshots', view='table', parent_key=parent_key, do_search=True)
        #content_wdg.set_sobjects(sobjects)
        content_td = table.add_cell()
        content_td.set_id("sobject_relation")
        content_td.add_style("display: table-cell")
        content_td.add_style("vertical-align: top")
        content_td.add_style("padding-left: 10px")
        content_td.add(content_wdg)

        div.add(table)

        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:104,代码来源:sobject_panel_wdg.py


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