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


Python Search.add_regex_filter方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_regex_filter [as 别名]
    def get_display(my):
        widget = DivWdg(id='link_view_select')
        widget.add_class("link_view_select")
        if my.refresh:
            widget = Widget()
        else:
            my.set_as_panel(widget)
        
        views = []
        if my.search_type:
            from pyasm.search import WidgetDbConfig
            search = Search( WidgetDbConfig.SEARCH_TYPE )
            search.add_filter("search_type", my.search_type)
            search.add_regex_filter("view", "link_search:|saved_search:", op="NEQI")
            search.add_order_by('view')
            widget_dbs = search.get_sobjects()
            views = SObject.get_values(widget_dbs, 'view')
        
        labels = [view for view in views]

        views.insert(0, 'table')
        labels.insert(0, 'table (Default)')
        st_select = SelectWdg('new_link_view', label='View: ')
        st_select.set_option('values', views)
        st_select.set_option('labels', labels)
        widget.add(st_select)
        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:29,代码来源:view_manager_wdg.py

示例2: init

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_regex_filter [as 别名]
    def init(my):
        # add search_type select
        my.search_type_sel = FilterSelectWdg("publish_search_type")
        search = Search(SearchType.SEARCH_TYPE)
        # search.add_where("\"search_type\" ~ '(^prod|^game).*'")
        search.add_regex_filter("search_type", "^prod|^game")
        search.add_order_by("search_type")
        my.search_type_sel.set_search_for_options(search, "search_type", "title")
        my.search_type_sel.set_option("default", "prod/asset")

        span = SpanWdg("Type: ", css="small smaller")
        span.add(my.search_type_sel)
        my.add(span)

        # add context field
        my.context_txt = TextWdg("snapshot_context")
        my.context_txt.add_style("margin-bottom", "0.4em")
        my.context_txt.set_option("size", "6")
        my.context_txt.set_submit_onchange()
        my.context_txt.set_persistence()
        span = SpanWdg("Context: ", css="small smaller")
        span.add(my.context_txt)

        my.add(span)

        # add date select

        label_list = ["Today", "Last 2 days", "Last 5 days", "Last 30 days"]
        value_list = ["today", "1 Day", "4 Day", "29 Day"]
        my.date_sel = DateFilterWdg(["publish_date", None])
        my.date_sel.set_label(label_list)
        my.date_sel.set_value(value_list)

        span = SpanWdg("Date: ", css="smaller")
        span.add(my.date_sel)

        my.user_filter = UserFilterWdg(pref="single")
        my.user_filter.get_navigator().set_submit_onchange()
        span.add(my.user_filter)
        my.add(span)
开发者ID:hellios78,项目名称:TACTIC,代码行数:42,代码来源:asset_filter_wdg.py

示例3: handle_add_instance

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

        WebContainer.register_cmd("pyasm.prod.web.SetCheckinCbk")

        self.add(DivWdg("Comments:"))
        textarea = TextAreaWdg("description")
        textarea.set_attr("cols", "30")
        textarea.set_attr("rows", "2")
        self.add(textarea)

        set_name = set.get_value("name")
        
        button = ProdIconSubmitWdg(self.PUBLISH_BUTTON, long=True)
        button.add_event("onclick", "if (checkin_set('%s','%s')!=true) return" \
            % (set_name, set.get_code() ))
        self.add(button)


        

        # get all of the assets belonging to this set
        search = Search("prod/asset")
        search.add_regex_filter('code', set_name, op='EQ' )
        set_assets = search.do_search()
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:maya_set_wdg.py

示例4: preprocess

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_regex_filter [as 别名]
    def preprocess(my):
        '''determine if this is for EditWdg or EDIT ROW of a table'''
        # get the number of task pipelines needed for EditWdg, which is one
        # for the EDIT ROW , there could be more than 1

        my.task_mapping = None
        from tactic.ui.panel import EditWdg
        if hasattr(my, 'parent_wdg') and isinstance(my.get_parent_wdg(), EditWdg):
            task = my.get_current_sobject()
            task_pipe_code = task.get_value('pipeline_code')

            # if the current task has no pipeline, then search for
            # any task pipeline
            if not task_pipe_code:
                # just use the default
                task_pipe_code = 'task'
            
            pipeline = Pipeline.get_by_code(task_pipe_code)
            if not pipeline:
                pipeline = Pipeline.get_by_code('task')
            my.task_pipelines = [pipeline]
        else:


            # get all of the pipelines for tasks
            search = Search('sthpw/pipeline')
            search.add_regex_filter('search_type', 'sthpw/task')
            my.task_pipelines = search.get_sobjects()

            # get all of the pipelines for the current search_type
            search_type = my.state.get("search_type");
            search = Search('sthpw/pipeline')
            if search_type:
                search.add_filter('search_type', search_type)
            my.sobject_pipelines = search.get_sobjects()

            # insert the default task pipeline if not overridden in the db
            default_task_found = False
            pipeline_codes = SObject.get_values(my.task_pipelines, 'code')
            if 'task' in pipeline_codes:
                default_task_found = True
            
            if not default_task_found:
                default_pipe = Pipeline.get_by_code('task')
                my.task_pipelines.append(default_pipe)
            
            
            my.task_mapping = {}

            # the following works for insert but on edit, it should read from pipeline_code attribute
            for pipeline in my.sobject_pipelines:
                processes = pipeline.get_process_names()
                for process in processes:
                    attrs = pipeline.get_process_attrs(process)
                    task_pipeline = attrs.get('task_pipeline')
                    if task_pipeline:
                        key = '%s|%s' %(pipeline.get_code(), process)
                        my.task_mapping[key] = task_pipeline


            #my.task_mapping = "|".join(my.task_mapping)

        my.is_preprocess = True
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:65,代码来源:misc_input_wdg.py

示例5: get_display

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

#.........这里部分代码省略.........

        # get all of the assets
        search = Search(self.search_type)
        
        if sobject_filter:
            sobject_filter.alter_search(search)

        if shot_filter:
            shot_statuses = shot_filter.get_statuses()
            shot_statuses_selected = shot_filter.get_values()
            if shot_statuses != shot_statuses_selected:
                search.add_filters("status", shot_filter.get_values() )

        assets = search.get_sobjects()
        
        if not assets:
            # drawing the empty table prevents the loss of some prefs data
            table = TableWdg("sthpw/task", self.task_view)
            #widget.add(HtmlElement.h3("No assets found"))
            widget.add(table)
            return widget

        # this assumes looking at one project only
        project_search_type = assets[0].get_search_type()
        
        ids = SObject.get_values(assets, 'id')

        # get all of the tasks
        search = Search("sthpw/task")
        if processed_start_date and start_date_wdg.get_value(True) != self.INVALID:
            search.add_where("(bid_start_date >= '%s' or actual_start_date >='%s')" \
                % (processed_start_date, processed_start_date))
        if processed_end_date and end_date_wdg.get_value(True) != self.INVALID:
            search.add_where("(bid_end_date <= '%s' or actual_end_date <='%s')" \
                % (processed_end_date, processed_end_date))

        # filter out sub pipeline tasks
        if not sub_task_cb.is_checked():
            search.add_regex_filter('process', '/', op='NEQ')

        search.add_filter("search_type", project_search_type)
        search.add_filters("search_id", ids )

        # order by the search ids of the asset as the were defined in the
        # previous search
        search.add_enum_order_by("search_id", ids)


        if user != "":
            search.add_filter("assigned", user)
        if milestone != "":
            search.add_filter("milestone_code", milestone)
        
        process_filter.alter_search(search)
        
        task_search_filter.alter_search(search)
       
        if not self.show_all_task_approvals:
            #task_filter = TaskStatusFilterWdg(task_pipeline="task")
            #widget.add(task_filter)
            task_statuses = task_filter.get_processes()
            task_statuses_selected = task_filter.get_values()
           
            # one way to show tasks with obsolete statuses when the user
            # check all the task status checkboxes
            if task_statuses != task_statuses_selected:
                search.add_filters("status", task_filter.get_values() )

            


        # filter for retired ...
        # NOTE: this must be above the search limit filter
        # because it uses a get count which commits the retired flag
        if retired_filter.get_value() == 'true':
            search.set_show_retired(True)

        
        # alter_search() will run set_search() implicitly
        search_limit.alter_search(search)

        # define the table
        table = TableWdg("sthpw/task", self.task_view)

        # get all of the tasks
        tasks = search.get_sobjects()
        sorted_tasks = self.process_tasks(tasks, search)

        widget.add( HtmlElement.br() )

        table.set_sobjects(sorted_tasks)

        # make some adjustments to the calendar widget
        calendar_wdg = table.get_widget("schedule")
        for name,value in self.calendar_options.items():
            calendar_wdg.set_option(name, value)

        widget.add(table)

        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:104,代码来源:task_manager_wdg.py


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