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


Python Search.add_column方法代码示例

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


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

示例1: init

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
 def init(self):
     search = Search(Bin)
     
     search.add_column('type')
     search.add_group_by('type')
     self.set_search_for_options(search, 'type','type')
     self.add_empty_option('-- Any --')
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:submission_wdg.py

示例2: preprocess

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

        sobjects = self.sobjects
        if not sobjects:
            return

        # find all of the instances in a shot
        sobject = sobjects[0]
        foreign_key = sobject.get_foreign_key()

        search_type = WebState.get().get_state("planner_search_type")
        search = Search( search_type )

        search.add_column(foreign_key)

        if len(sobjects) == 1:
            search.add_filter(foreign_key, sobject.get_code())
        else:
            search_codes = [x.get_code() for x in sobjects]
            search.add_filters(foreign_key, search_codes)

        search_type = sobject.get_search_type()
        search.add_order_by(foreign_key)
        children = search.get_sobjects()

        # convert to a dictionary
        for child in children:
            code = child.get_value(foreign_key)
            number = self.numbers.get(code)
            if not number:
                number = 0
           
            number += 1
            self.numbers[code] = number
开发者ID:mincau,项目名称:TACTIC,代码行数:36,代码来源:sobject_planner_wdg.py

示例3: init

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
 def init(my):
     search = Search(Bin)
     
     search.add_column('label')
     search.add_group_by('label')
     my.set_search_for_options(search, 'label','label')
     my.add_empty_option('-- Any --')
开发者ID:0-T-0,项目名称:TACTIC,代码行数:9,代码来源:submission_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
    def get_display(my):
        widget = Widget()
        span = SpanWdg('[ projects ]', css='hand')
        span.add_style('color','white')
        span.add_event('onclick',"spt.show_block('%s')" %my.WDG_ID)
        widget.add(span)
        
        # add the popup
        div = DivWdg(id=my.WDG_ID, css='popup_wdg')
        widget.add(div)
        div.add_style('width', '80px')
        div.add_style('display', 'none')
        title_div = DivWdg()
        div.add(title_div)
        title = FloatDivWdg(' ', width='60px')
        title.add_style('margin-right','2px')
        title_div.add_style('padding-bottom', '4px')
        title_div.add(title)
        title_div.add(CloseWdg(my.get_off_script(), is_absolute=False))


        div.add(HtmlElement.br())
        
        search = Search(Project)
        search.add_where("\"code\" not in ('sthpw','admin')")
        search.add_column('code')
        projects = search.get_sobjects()
        values = SObject.get_values(projects, 'code')

        web = WebContainer.get_web()
        root = web.get_site_root()
        
        
        security = Environment.get_security()
        for value in values:
            if not security.check_access("project", value, "view"):
                continue
            script = "location.href='/%s/%s'"%(root, value)
            sub_div = DivWdg(HtmlElement.b(value), css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)
        
        div.add(HtmlElement.hr())
        if security.check_access("project", 'default', "view"):
            script = "location.href='/%s'" % root
            sub_div = DivWdg('home', css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)

        if security.check_access("project", "admin", "view"):
            script = "location.href='/%s/admin/'" %root
            sub_div = DivWdg('admin', css='selection_item') 
            sub_div.add_event('onclick', script)
            div.add(sub_div)

       

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

示例5: alter_search

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

        # get all of the relevant tasks to the user
        task_search = Search("sthpw/task")
        task_search.add_column("search_id")

        # only look at this project
        project = Project.get_project_name()
        task_search.add_filter("search_type", search.get_search_type())

        # figure out who the user is
        security = Environment.get_security()
        login = security.get_login()
        user = login.get_value("login")



        print "is_artist: ", self.is_artist()
        print "is_supervisor: ", self.is_supervisor()


        # do some filtering
        web = WebContainer.get_web()
        show_assigned_only = self.checkbox.get_value()
        show_process = web.get_form_values("process")
        if not show_process or show_process[0] == '':
            show_process = []

        show_task_status = web.get_form_values("task_status")
        if not show_task_status or show_task_status[0] == '':
            show_task_status = []


        if show_assigned_only == "on":
            task_search.add_filter("assigned", user)

        if show_process:
            where = "process in (%s)" % ", ".join( ["'%s'" % x for x in show_process] )
            task_search.add_where(where)

        if show_task_status:
            where = "status in (%s)" % ", ".join( ["'%s'" % x for x in show_task_status] )
            task_search.add_where(where)
        else:
            task_search.add_where("NULL")




        # record the tasks
        self.tasks = task_search.get_sobjects()

        # get all of the sobject ids
        sobject_ids = ["'%s'" % x.get_value("search_id") for x in self.tasks]

        # get all of the sobjects related to this task
        if sobject_ids:
            search.add_where( "id in (%s)" % ", ".join(sobject_ids) )
开发者ID:mincau,项目名称:TACTIC,代码行数:60,代码来源:artist_view_wdg.py

示例6: execute

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
    def execute(my):
        project = Project.get()

        search = Search("sthpw/transaction_log")
        search.add_filter("namespace", project.get_code() )
        search.add_column("code")

        transactions = search.get_sobjects()
        codes = SObject.get_values(transactions, "code")
        codes = set(codes)

        # dump out the transactions for this project
        f = open("/tmp/transactions_codes", 'wb')
        f.write(str(codes))
        f.close()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:17,代码来源:watch_handoff_folder.py

示例7: categorize

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
    def categorize(my, widget, search_type, search):
        '''categorize parents based on search_type'''
        # FIXME: this should not be here.  This is a general class for all
        # search types, not just prod/asset
        if my.get_option('read_only') != 'true':
            if search_type == "prod/asset":
                lib_select = FilterSelectWdg('parent_lib')
                lib_select.persistence = False
                search2 = Search("prod/asset_library")
                lib_select.set_search_for_options( search2, "code", "title" )
                lib_select.add_empty_option("-- Any --")
                widget.add(lib_select) 
                # get all of the options for this search type
                parent_lib = lib_select.get_value()
                if parent_lib:
                    search.add_filter('asset_library', parent_lib)
            elif search_type == "prod/shot":
                lib_select = FilterSelectWdg('parent_lib')
                lib_select.persistence = False
                search2 = Search("prod/sequence")
                lib_select.set_search_for_options( search2, "code", "code" )
                lib_select.add_empty_option("-- Any --")
                
                widget.add(lib_select)

                # get all of the options for this search type
                parent_lib = lib_select.get_value()
                if parent_lib:
                    search.add_filter('sequence_code', parent_lib)
            elif search_type == 'prod/texture':
                lib_select = FilterSelectWdg('parent_lib')
                lib_select.persistence = False
                search2 = Search("prod/texture")
                search2.add_column('category')
                search2.add_group_by("category")
                lib_select.set_search_for_options( search2, "category", "category" )
                lib_select.add_empty_option("-- Any --")
                widget.add(lib_select)

                # get all of the options for this search type
                parent_lib = lib_select.get_value()
                if parent_lib:
                    search.add_filter('category', parent_lib)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:45,代码来源:task_wdg.py

示例8: _get_bins

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

        # get all the types in the Bin table
        type_search = Search(Bin)
        type_search.add_column('type')
        type_search.add_group_by('type')
        types = SObject.get_values(type_search.get_sobjects(), 'type')

        select = SelectWdg('display_limit')
        select.set_option('persist', 'true')
        display_limit = select.get_value()
        if display_limit:
            self.display_limit = display_limit

        # by default, get 10 for each type
        joined_statements = []
        for type in types:
            # TODO: fix this sql to run through search
            select = Search('prod/bin')
            select.add_filter("type", type)
            select.set_show_retired(False)
            select.add_order_by("code")
            select.add_limit(self.display_limit)
            statement = select.get_statement()
            joined_statements.append(statement)

            #joined_statements.append("select * from \"bin\" where \"type\" ='%s' and (\"s_status\" != 'retired' or \"s_status\" is NULL)" \
            #    " order by \"code\" desc limit %s" % (type, self.display_limit))

        if len(joined_statements) > 1:
            joined_statements = ["(%s)"%x for x in joined_statements]
            statement = ' union all '.join(joined_statements)
        elif len(joined_statements) == 1:
            statement = joined_statements[0]
        else:
            # no bins created yet
            return []
        #print "statement: ", statement
    
        return Bin.get_by_statement(statement)
开发者ID:mincau,项目名称:TACTIC,代码行数:44,代码来源:submission_wdg.py

示例9: _map_display_label

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

        my.display_label = ''

        target_table = my.get_option("target_table")
        target_column = my.get_option("target_column")

        source_column = my.get_option("source_column")
        display_column = my.get_option("display_column")

        my.sobject = my.get_current_sobject()
        my.mapping_value = my.sobject.get_data().get( source_column )

        # do search here
        search = Search( target_table )
        search.add_filter( target_column, my.mapping_value)
        search.add_column( display_column )

        items = search.get_sobjects()
        if items:
            my.display_label = items[0].get_data().get( display_column )
开发者ID:funic,项目名称:TACTIC,代码行数:23,代码来源:table_element_wdg.py

示例10: execute

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

        server = Config.get_value("install", "server")

        search_types = ['sthpw/note', 'sthpw/task']
        prefixes = ["NOTE", "TASK"]
        

        for j, search_type in enumerate(search_types):

            search = Search(search_type)
            search.add_column("id")
            search.add_column("code")
            sobjects = search.get_sobjects()
            num = len(sobjects)
            print "Found [%s] of %s" % (num, search_type)


            for i, sobject in enumerate(sobjects):
                code = sobject.get_code()
                if code.startswith(server):
                    continue

                if not code:
                    #sobject.delete()
                    continue

                if not code.startswith(prefixes[j]):
                    continue

                print "(%s of %s) %s" % (i, num, code)

                new_code = "%s%s" % (server,code)

                sobject.set_value("code", new_code)
                sobject.commit()
开发者ID:Southpaw-TACTIC,项目名称:TACTIC,代码行数:38,代码来源:remap_codes.py

示例11: get_tasks

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
    def get_tasks(my, sobjects=[]):


        # get all of the relevant tasks to the user
        task_search = Search("sthpw/task")
        task_search.add_column("search_id", distinct=True)


        if sobjects:
            task_search.add_filter("search_type", sobjects[0].get_search_type() )
            sobject_ids = SObject.get_values(sobjects, "id", unique=True)
            task_search.add_filters("search_id", sobject_ids)


        # only look at this project
        search_type = SearchType.get(my.search_type).get_full_key()
        task_search.add_filter("search_type", search_type)


        my.process_filter.alter_search(task_search)
        if isinstance(my.user_filter, UserFilterWdg):
            my.user_filter.alter_search(task_search)
        else:
            user = Environment.get_user_name()
            task_search.add_filter('assigned', user)
        
        status_filters = my.task_status_filter.get_values()
        
        if not status_filters:
            return []

        task_search.add_filters("status", status_filters)

        tasks = task_search.get_sobjects()
        
        return tasks
开发者ID:0-T-0,项目名称:TACTIC,代码行数:38,代码来源:approval_manager_wdg.py

示例12: get_transaction_info

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

        remote_server = my.get_remote_server()

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

        project_code = my.kwargs.get("project_code")
        if not project_code:
            project_code = Project.get_project_code()

        print "search_keys: ", search_keys

        if search_keys:
            search_keys_str = "|".join(search_keys)
            # need to get the code from the search_keys
            codes = []
            for search_key in search_keys:
                # HACK
                parts = search_key.split("code=")
                code = parts[1]
                codes.append(code)
            codes_str = "|".join(codes)

            filters = [
                ['code','in',codes_str]
            ]
            remote_codes = remote_server.query("sthpw/transaction_log", filters=filters, columns=['code'], order_bys=['timestamp'])

        elif my.start_expr:

            start_date = my.get_date(my.start_expr)

            # FIXME: this only works with Postgres
            filters = [
	        ['timestamp', '>', str(start_date)],
            ]

            if project_code:
                filters.append( ['namespace', project_code] )

            remote_codes = remote_server.query("sthpw/transaction_log", filters=filters, columns=['code'], order_bys=['timestamp'])
        else:
            raise TacticException("No start date expression given")


        print "# remote codes: ", len(remote_codes)



        # get all of the local transactions with the same filters
        search = Search("sthpw/transaction_log")
        search.add_column("code")
        search.add_filter("namespace", project_code)
        search.add_op_filters(filters)
        search.add_order_by("timestamp")
        print "search: ", search.get_statement()
        local_codes = search.get_sobjects()
        print "local codes: ", local_codes

        lset = set()
        for lt in local_codes:
            lcode = lt.get_value("code")
            if not lcode:
                continue
            lset.add(lcode)
            

        rset = set()
        for rt in remote_codes:
            rcode = rt.get("code")
            if not rcode:
                continue
            rset.add(rcode)
            

        info = {}
        remote_diff = rset.difference(lset)
        local_diff = lset.difference(rset)

        # go get the missing remote transactions
        filters = [['code', 'in', "|".join(remote_diff)]]
        remote_transactions = remote_server.query("sthpw/transaction_log", filters=filters, order_bys=['timestamp'])
        for i, transaction in enumerate(remote_transactions):
            sobject = SearchType.create("sthpw/transaction_log")
            sobject.data = transaction
            remote_transactions[i] = sobject
        info['remote_transactions'] = remote_transactions
 

        search = Search("sthpw/transaction_log")
        search.add_filters("code", local_diff)
        search.add_order_by("timestamp")
        local_transactions = search.get_sobjects()
        info['local_transactions'] = local_transactions

        local_paths = []
        for transaction in local_transactions:
            paths = my.get_file_paths(transaction)
            if not paths:
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:sync_utils.py

示例13: get_display

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

#.........这里部分代码省略.........
        menu.add(menu_item)


        def add_project_menu(menu, project):
            project_code = project.get_code()
            menu_item = MenuItem(type='action', label=project.get_value("title"))

            web = WebContainer.get_web()
            browser = web.get_browser()

            if browser != 'Qt':

                menu_item.add_behavior( {
                'type': 'click_up',
                'project_code': project_code,
                'cbjs_action': '''
                window.open('/tactic/%s/');
                ''' % project_code
                } )

            else:
                menu_item.add_behavior( {
                'project_code': project_code,
                'cbjs_action': '''
                spt.app_busy.show("Jumping to Project ["+bvr.project_code+"]", "");
                document.location = '/tactic/%s/';
                ''' % project_code
                } )

            menu.add(menu_item)


        search = Search("sthpw/project")
        search.add_column("category", distinct=True)
        categories = [x.get_value("category") for x in search.get_sobjects() ]
        for category in categories:
            if category == '':
                continue

            # FIXME: a little inefficient, but should be ok for now
            category_projects = []
            for project in projects:
                if project.get_value("category") != category:
                    continue

                project_code = project.get_code()
                if not security.check_access("project", project_code, "view"):
                    continue
                
                category_projects.append(project)

            if category_projects:
                suffix = Common.get_filesystem_name(category)
                label = "%s (%s)" % (category, len(category_projects))
                menu_item = MenuItem(type='submenu', label=label)
                menu_item.set_submenu_tag_suffix(suffix)
                menu.add(menu_item)

                submenu = Menu(width=200, menu_tag_suffix=suffix)
                menus.append(submenu)
                for project in category_projects:
                    add_project_menu(submenu, project)


        from pyasm.security import get_security_version
        security_version = get_security_version()
开发者ID:hellios78,项目名称:TACTIC,代码行数:70,代码来源:page_header_wdg.py

示例14: init

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import add_column [as 别名]
 def init(my):
     search = Search(CommandSObj)
     search.add_column('notification_code')
     search.add_group_by('notification_code')
     my.set_search_for_options(search, 'notification_code','notification_code')
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:7,代码来源:misc_input_wdg.py

示例15: get_display

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

        my.search_type = my.kwargs.get("search_type")
        if not my.search_type:
            my.search_type = 'sthpw/task'

        my.column = my.kwargs.get("column")
        if not my.column:
            my.column = 'status'


        my.project_code = my.kwargs.get("project_code")
        if not my.project_code:
            my.project_code = Project.get_project_code()

        my.bar_width = my.kwargs.get("bar_width")
        if not my.bar_width:
            my.bar_width = 200


        values = my.kwargs.get("values")
        if values:
            values = values.split("|")

        else:
            pipeline_code = my.kwargs.get("pipeline_code")
            if pipeline_code:
                pipeline = Pipeline.get_by_code(pipeline_code)
                values = pipeline.get_process_names()
            else:    
                search = Search(my.search_type)
                search.add_filter("project_code", my.project_code)
                search.add_column(my.column, distinct=True)
                xx = search.get_sobjects()
                values = [x.get_value(my.column) for x in xx]


        search = Search(my.search_type)
        search.add_filter("project_code", my.project_code)
        search.add_filters(my.column, values)
        total = search.get_count()




        colors = ['#900', '#090', '#009', '#990', '#099', '#909', '#900', '#090', '#009', '#990']
        while len(values) > len(colors):
            colors.extend(colors)

        top = DivWdg()
        top.add_color("background", "background")

        date = "@FORMAT(@STRING($TODAY),'Dec 31, 1999')"
        date = Search.eval(date, single=True)
        title = "Tasks Status Chart"

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add(title)
        title_wdg.add(" [%s]" % date)
        title_wdg.add_style("font-size: 14")
        title_wdg.add_color("background", "background3")
        title_wdg.add_color("color", "color3")
        title_wdg.add_style("padding: 10px")
        title_wdg.add_style("font-weight: bold")
        title_wdg.add_style("text-align: center")


        inner = DivWdg()
        top.add(inner)
        inner.center()
        inner.add_style("width: 500px")
        inner.add_style("padding: 30px")


        for i,status in enumerate(values):

            if not status:
                continue

            count = my.get_count(status)
            div = my.get_div(status, count, total, colors[i])
            inner.add( div.get_buffer_display() )
            inner.add( "<br clear='all'/>")

        inner.add("<hr/>")

        div = my.get_div("Total", total, total, "gray")
        inner.add( div.get_buffer_display() )
        inner.add("<br clear='all'/>")


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


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