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


Python CheckboxWdg.set_persistence方法代码示例

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


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

示例1: get_instantiation_wdg

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_persistence [as 别名]
    def get_instantiation_wdg(self):
        setting = self.get_default_setting()
        default_instantiation = setting.get('instantiation')

        div = DivWdg()
        is_unchecked = True
        default_cb = None
        for value in self.get_instantiation_options():
            name = self.get_element_name("instantiation")
            checkbox = CheckboxWdg( name )
            if value == default_instantiation:
                default_cb = checkbox
            
            checkbox.set_option("value", value)
            checkbox.set_persistence()
            if checkbox.is_checked():
                is_unchecked = False
            checkbox.add_behavior({'type': 'click_up', 
                    'propagate_evt': True,
                     "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name}) 
            span = SpanWdg(checkbox, css='small')
            span.add(value)
            div.add(span)
        if is_unchecked:
            default_cb.set_checked()
        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:load_options_wdg.py

示例2: init

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_persistence [as 别名]
 def init(self):
     self.add("Process: ")
     checkbox = CheckboxWdg("process")
     checkbox.set_option("value", "on")
     checkbox.set_persistence()
     checkbox.add_event("onclick", "document.form.submit()")
     self.add(checkbox)
开发者ID:mincau,项目名称:TACTIC,代码行数:9,代码来源:artist_view_wdg.py

示例3: get_render_icon_wdg

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_persistence [as 别名]
 def get_render_icon_wdg(my):
     '''Checkbox determines whether to create icon'''
     div = DivWdg()
     div.add("Create Icon: ")
     checkbox = CheckboxWdg("render")
     checkbox.set_persistence()
     div.add(checkbox)
     return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:10,代码来源:app_sobject_checkin_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_persistence [as 别名]
    def get_display(self):
    
        widget = Widget()
        
        div = DivWdg(css='spt_ui_options')
        div.set_unique_id()
        table = Table()
        div.add(table)
        table.add_style("margin: 5px 15px")
        table.add_color('color','color')

        swap = SwapDisplayWdg()
        #swap.set_off()
        app = WebContainer.get_web().get_selected_app()
        outer_span = SpanWdg()
        outer_span.add_style('float: right')
        span = SpanWdg(app, css='small')
        icon = IconWdg(icon=eval("IconWdg.%s"%app.upper()), width='13px')
        outer_span.add(span)
        outer_span.add(icon)
        
        title = SpanWdg("Loading Options")
        title.add(outer_span)

        SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False)

        widget.add(swap)
        widget.add(title)
        widget.add(div)

        if not self.hide_instantiation:
            table.add_row()
            table.add_blank_cell()
            div = DivWdg(HtmlElement.b("Instantiation: "))
            table.add_cell(div)
            div = self.get_instantiation_wdg()
            table.add_cell(div)


        setting = self.get_default_setting()
        default_instantiation = setting.get('instantiation')
        default_connection = setting.get('connection')
        default_dependency = setting.get('texture_dependency')

        if not self.hide_connection:
            table.add_row()
            table.add_blank_cell()
            con_div = DivWdg(HtmlElement.b("Connection: "))
            table.add_cell(con_div)
            td = table.add_cell()

            is_unchecked = True
            default_cb = None
            for value in ['http', 'file system']:
                name = self.get_element_name("connection")
                checkbox = CheckboxWdg( name )
                checkbox.set_option("value", value)
                checkbox.set_persistence()
                if value == default_connection:
                    default_cb = checkbox
                if checkbox.is_checked():
                    is_unchecked = False
                checkbox.add_behavior({'type': 'click_up', 
                    'propagate_evt': True,
                     "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name}) 
                span = SpanWdg(checkbox, css='small')
                span.add(value)

                td.add(span)
            if is_unchecked:
                default_cb.set_checked()



        if not self.hide_dependencies:
            table.add_row()
            table.add_blank_cell()
            div = DivWdg(HtmlElement.b("Texture Dependencies: "))
            table.add_cell(div)
            td = table.add_cell()
            
            is_unchecked = True
            default_cb = None
            for value in ['as checked in', 'latest', 'current']:
                name = self.get_element_name("dependency")
                checkbox = CheckboxWdg( name )

                
                checkbox.set_option("value", value)
                checkbox.set_persistence()
                checkbox.add_behavior({'type': 'click_up', 
                    'propagate_evt': True,
                     "cbjs_action": "spt.toggle_checkbox(bvr, '.spt_ui_options', '%s')" %name}) 
                if value == default_dependency:
                    default_cb = checkbox
                if checkbox.is_checked():
                    is_unchecked = False

                span = SpanWdg(checkbox, css='small')
                span.add(value)
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:load_options_wdg.py

示例5: get_display

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

        div = DivWdg()
        div.add_style("padding: 10px 0px 10px 0px")

        behavior = {"type": "keyboard", "kbd_handler_name": "DgTableMultiLineTextEdit"}
        div.add_behavior(behavior)

        project_code = None
        sobject = my.get_current_sobject()
        if sobject:
            project_code = sobject.get_project_code()
        project_filter = Project.get_project_filter(project_code)

        query_filter = my.get_option("query_filter")
        if not query_filter:
            # try getting it from the search_type
            web = WebContainer.get_web()
            search_type = web.get_form_value("search_type")
            if search_type:
                search_type_obj = SearchType.get(search_type)
                base_search_type = search_type_obj.get_base_search_type()
                query_filter = "search_type = '%s'" % base_search_type

        # add the project filter
        if query_filter:
            query_filter = "%s and %s" % (query_filter, project_filter)
        else:
            query_filter = project_filter

        my.set_option("query_filter", query_filter)

        select = SelectWdg()
        select.add_empty_option("-- Select --")
        select.copy(my)

        select.add_event("onchange", "alert('cow')")
        div.add(select)

        span = SpanWdg(css="med")
        span.add("Add Initial Tasks: ")
        checkbox = CheckboxWdg("add_initial_tasks")
        checkbox.set_persistence()
        if checkbox.is_checked(False):
            checkbox.set_checked()
        span.add(checkbox)
        div.add(span)

        # list all of the processes with checkboxes
        pipeline_code = select.get_value()
        if pipeline_code:
            pipeline = Pipeline.get_by_code(pipeline_code)
            if not pipeline:
                print "WARNING: pipeline '%s' does not exist" % pipeline_code
                return
            process_names = pipeline.get_process_names(recurse=True)

            process_div = DivWdg()
            for process in process_names:
                checkbox = CheckboxWdg("add_initial_tasks")
                process_div.add(checkbox)
                process_div.add(" ")
                process_div.add(process)
                process_div.add(HtmlElement.br())
            div.add(process_div)

        return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:69,代码来源:asset_task_creator_wdg.py

示例6: ArtistViewWdg

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import set_persistence [as 别名]
class ArtistViewWdg(SpanWdg):

    def init(self):
        self.add("Show assigned only: ")
        self.checkbox = CheckboxWdg("show_assigned_only")
        self.checkbox.set_option("value", "on")
        self.checkbox.set_persistence()
        self.checkbox.add_event("onclick", "document.form.submit()")
        self.add(self.checkbox)


        self.add_class("med")



    def is_supervisor(self):
        # if the user is a supervisor, look at all of the assets
        project = Project.get_project_name()
        security = Environment.get_security()
        return security.check_access("prod/%s" % project, "model/supervisor", "true")

    def is_artist(self):
        # if the user is a artist, look at all of the assets
        project = Project.get_project_name()
        security = Environment.get_security()
        return security.check_access("prod/%s" % project, "model/artist", "true")


    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,代码行数:88,代码来源:artist_view_wdg.py


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