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


Python SelectWdg.set_option方法代码示例

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


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

示例1: get_sync_mode_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_sync_mode_wdg(self):

        div = DivWdg()
        div.add_class("spt_sync_mode")

        div.add("Share Mode: ")
        select = SelectWdg("sync_mode")
        div.add(select)
        select.set_option("values", "file|xmlrpc")

        select.add_behavior( {
            'type': 'change',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_sync_mode");
            var value = bvr.src_el.value;
            var xmlrpc_el = top.getElement(".spt_xmlrpc_mode");
            var file_el = top.getElement(".spt_file_mode");

            if (value == 'xmlrpc') {
                spt.show(xmlrpc_el);
                spt.hide(file_el);
            }
            else {
                spt.hide(xmlrpc_el);
                spt.show(file_el);
            }
            '''
        } )

        div.add( self.get_xmlrpc_mode_wdg() )
        div.add( self.get_file_mode_wdg() )

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:35,代码来源:sync_settings_wdg.py

示例2: get_security_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_security_wdg(self):

        div = DivWdg()
        div.add_class("spt_security")

        div.add("A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced.")

        div.add("<br/>"*2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin','unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")


        div.add("<br/>"*2)

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:34,代码来源:sync_settings_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [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

示例4: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_display(my):
        sobject = my.get_current_sobject()
        key = sobject.get_value("key")
        options = sobject.get_value("options")
        type = sobject.get_value("type")

        # get the value of the users preferences
        search = Search("sthpw/pref_setting")
        search.add_user_filter()
        search.add_filter("key", key)
        pref_setting = search.get_sobject()
        if pref_setting:
            value = pref_setting.get_value("value")
        else:
            value = ""

        div = DivWdg()

        element_name = "%s_%s" % (my.get_name(), sobject.get_id() )
      
        script = '''var server = TacticServerStub.get();
                var value = bvr.src_el.value;
                if (!value) return;

                spt.app_busy.show("Saving", "Saving Preference for [%s]");

                setTimeout( function() {
                    try{
                        server.execute_cmd('tactic.ui.table.SetPreferenceCmd', {key: '%s', value: value});
                    }catch(e){
                        spt.alert(spt.exception.handler(e));
                    }
                        
                    spt.app_busy.hide() 
                        
                    }, 200);'''%(key, key)

        if key in ['skin', 'palette', 'js_logging_level']:
            script = '''%s; spt.app_busy.show('Reloading Page ...'); setTimeout('spt.refresh_page()', 200);'''%script

        if type == "sequence":
            from pyasm.prod.web import SelectWdg
            select = SelectWdg(element_name)
            select.add_behavior({'type': "change", 
                'cbjs_action': script})

            select.set_option("values",options)
            if value:
                select.set_value(value)
            div.add(select)
        else:
            text = TextWdg(element_name)
            text.add_behavior({'type': "blur", 
                'cbjs_action': script})
            if value:
                text.set_value(value)
            div.add(text)
     
        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:61,代码来源:preference_wdg.py

示例5: configure_category

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def configure_category(my, title, category, options, options_type = {}):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)


        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            option_type = options_type.get(option)
            validation_scheme = ""

            #add selectWdg for those options whose type is bool
            if option_type == 'bool':
                text = SelectWdg(name="%s/%s" % (category, option))
                text.set_option('values','true|false')
                text.set_option('empty','true')
                text.add_style("margin-left: 0px")

                        
            elif option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))

            # dealing with options whose type is number   
            else:
                if option_type == 'number':
                    validation_scheme = 'INTEGER'
                    
                else:
                    validation_scheme = ""

                text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
                

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

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

示例6: get_input_by_arg_key

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
 def get_input_by_arg_key(self, key):
     if key == 'icon':
         input = SelectWdg("option_icon_select")
         input.set_option("values", IconWdg.get_icons_keys())
         input.add_empty_option("-- Select --")
     elif key == 'script':
         input = SelectWdg("option_script_select")
         input.set_option("query", "config/custom_script|code|code" )
         input.add_empty_option("-- Select --")
     else:
         input = TextWdg("value")
     return input
开发者ID:mincau,项目名称:TACTIC,代码行数:14,代码来源:button_wdg.py

示例7: get_action_wdg

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

        filter_div = DivWdg()

        select = SelectWdg("filter_action")
        select.add_empty_option("-- search action --")
        select.add_style("text-align: right")
        select.set_option("labels", "Retrieve Search|Save Search")
        select.set_option("values", "retrieve|save")
        select.add_event("onchange", "spt.dg_table.search_action_cbk(this)")
        filter_div.add(select)

        return filter_div
开发者ID:hellios78,项目名称:TACTIC,代码行数:15,代码来源:search_wdg.py

示例8: get_display

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

        widget = DivWdg()

        pipeline_code = my.get_option('pipeline')
        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            widget.add("No pipeline defined")
            return widget
            

        processes = pipeline.get_process_names()

        widget.add_style("border: solid 1px blue")
        widget.add_style("position: absolute")
        widget.add_style("top: 300")
        widget.add_style("left: -500")

        for process in processes:

            #inputs = pipeline.get_input_processes(process)
            outputs = pipeline.get_output_processes(process)

            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")
            div.add_attr("spt_input_key", process)

            #if not outputs:
            #    # then we can't go anywhere, so just add a message
            #    text = ""
            #    div.add(text)
            #    continue

            values = []
            #values.extend( [str(x) for x in inputs] )
            values.append(process)
            values.extend( [str(x) for x in outputs] )


            select = SelectWdg(my.get_input_name())
            select.set_value(process)
            select.add_empty_option('-- Select --')
            select.set_option("values", values)
            div.add(select)

            from tactic.ui.panel import CellEditWdg
            CellEditWdg.add_edit_behavior(select)


        return widget
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:53,代码来源:misc_input_wdg.py

示例9: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_display(self):
        # add a view action
        view_div = DivWdg()
        view_select = SelectWdg("action|view_action")
        view_select.add_style("text-align: right")
        view_select.add_empty_option("-- view --")
        view_select.set_option("values", "copy_url|add_my_view|edit|save|rename|delete|custom_property|custom_script")
        view_select.set_option("labels", "X Copy URL to this View|Add to My Views|Edit as Draft|Save Project View As|X Rename View|X Delete View|Add Custom Property|Add Custom Script")
        view_div.add_style("float: right")
        view_div.add(view_select)

        view_select.add_event("onchange", "spt.dg_table.view_action_cbk(this,'%s')" % self.table_id)

        return view_div
开发者ID:mincau,项目名称:TACTIC,代码行数:16,代码来源:action_wdg.py

示例10: get_display

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

        search_type = "prod/asset"
    
        web = WebContainer.get_web()
        related_asset = web.get_form_value("edit|related")
        search = Search(search_type)
        search.add_filter("code", related_asset)
        sobjects = search.get_sobjects()

        labels = "|".join( ["%s - %s" % (x.get_code(), x.get_value("name") ) for x in sobjects ] )
        values = "|".join( [x.get_code() for x in sobjects ] )

        select = SelectWdg( my.get_input_name() )
        select.set_persist_on_submit()
        select.set_option("values", values)
        select.set_option("labels", labels)
        select.set_option("web_state","true")

        return select
开发者ID:0-T-0,项目名称:TACTIC,代码行数:22,代码来源:related_asset_wdg.py

示例11: get_display

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

        div = DivWdg()
        table = Table()
        table.set_class("minimal")
        table.add_style("font-size: 0.8em")
        table.add_row()
        table.add_cell("File")
        table.add_cell('<input type="file" name="%s"/>' % (my.get_input_name())
        )
        table.add_row()
        table.add_cell("Context")

        select = SelectWdg("%s|context" % my.get_input_name() )
        select.set_option("values", "publish|roughDesign|colorFinal|colorKey")
        table.add_cell(select)

        table.add_row()
        table.add_cell("Description")
        table.add_cell('<textarea name="%s|description"></textarea>' % my.get_input_name())
        div.add(table)

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

示例12: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_display(self):
        top = DivWdg()
        top.add_style("width: 200px")
        top.add_style("height: 200px")
        top.add_color("background", "background")
        top.add_color("padding", "10px")
        top.add_border()

        template = self.get_option("template")
        template = "prod/sequence"

        select = SelectWdg("foo")
        top.add(select)
        select.set_option("values", "XG|FF|WOW")

        text = TextWdg("foo")
        top.add(text)



        top.add("!!!!!")


        return top
开发者ID:mincau,项目名称:TACTIC,代码行数:26,代码来源:related_element_wdg.py

示例13: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import set_option [as 别名]
    def get_display(my):
       
        name = my.kwargs.get('name')
        select = SelectWdg(name)
        select.add_class('twog_move_select')
        select.set_option('empty','true')
        # limit to last 10
        select.set_options(my.kwargs)

        # if it's not set from kwargs, we have this default values/labels
        if not my.kwargs.get('values_expr'):
            select.set_option('values_expr', "@GET(twog/movement['@LIMIT','10']['@ORDER_BY','timestamp desc'].code)")
            select.set_option('labels_expr', "@GET(twog/movement['@LIMIT','10']['@ORDER_BY','timestamp desc'].code) + ':' + @GET(twog/movement['@LIMIT','10']['@ORDER_BY','timestamp desc'].name)")
        return select
开发者ID:2gDigitalPost,项目名称:custom,代码行数:16,代码来源:order_entry_wdg.py

示例14: get_display

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


        state = my.get_state()
        search_type = state.get("search_type")
        sobj = my.get_current_sobject()

        if search_type:
            st = search_type
        else:
            
            st = sobj.get_base_search_type()
        # for inline insert, this should proceed
        #if not sobj:
        #    return ''
        
        st_suffix = st.split('/', 1)
    
        if len(st_suffix) == 2:
            st_suffix = st_suffix[1]
        
        search = Search('sthpw/pipeline')
        search.add_op_filters([('search_type','EQ', '/%s' %st_suffix)])

        # takes into account site-wide pipeline
        search.add_project_filter(show_unset=True)
        sobjects = search.get_sobjects()

        codes = [x.get_code() for x in sobjects]

        if my.get_option("use_code") in [True, 'true']:
            names = codes
        else:

            names = []
            for x in sobjects:
                name = x.get_value("name")
                if not name:
                    name = x.get_value("code")
                names.append(name)



        select = SelectWdg(my.get_input_name())
        select.add_empty_option("-- Default --")
        select.set_option("values", codes)
        select.set_option("labels", names)
        if sobj:
            value = sobj.get_value(my.get_name())
            if value:
                select.set_value(value)

        else: 
            # only for inline
            #behavior =  { 'type': 'click',
            #       'cbjs_action': 'spt.dg_table.select_wdg_clicked( evt, bvr.src_el );'}
            #select.add_behavior(behavior)
            pass
        

        return select
开发者ID:nuxping,项目名称:TACTIC,代码行数:63,代码来源:pipeline_input_wdg.py

示例15: get_shelf_wdg

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

        process = my.get_value("process")
        versions = my.get_value("versions")

        div = DivWdg()

        filter_table = Table()
        div.add(filter_table)
        filter_table.add_row()


        button = SingleButtonWdg(title="Refresh", icon=IconWdg.REFRESH)
        filter_table.add_cell(button)
        filter_table.add_cell("&nbsp;"*5)
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            spt.panel.refresh(bvr.src_el);
            '''
        } )

        # get all of the pipelnes for this search type
        pipeline_code = my.sobject.get_value("pipeline_code", no_exception=True)
        processes = []
        if pipeline_code:
            pipeline = Pipeline.get_by_code(pipeline_code)
            if pipeline:
                process_names = pipeline.get_process_names()
                processes.extend(process_names)

        processes.insert(0, "all")



        filter_table.add_cell("Process: ")
        select = SelectWdg("process")
        select.add_style("width: 200px")
        if process != 'all':
            select.set_value(process)

        select.set_option("values", processes)

        filter_table.add_cell(select)



        filter_table.add_cell("&nbsp;"*10)

        filter_table.add_cell("Versions: ")
        select = SelectWdg("versions")
        select.add_style("width: 200px")
        select.set_option("values", "latest|current|today|last 10|all")
        if versions:
            select.set_value(versions)
        filter_table.add_cell(select)


        asset_dir = Environment.get_asset_dir()

        select = IconButtonWdg( tip="Toggle Selection", icon=IconWdg.SELECT, show_arrow=False )
        div.add(select)
        select.add_style("float: right")
        select.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top_class = 'spt_sobject_dir_list_top'
            var toggle_state = bvr.src_el.getAttribute('toggle');
            if (toggle_state && toggle_state=='true')
                bvr.src_el.setAttribute('toggle','false');
            else
                bvr.src_el.setAttribute('toggle','true');

            var top = bvr.src_el.getParent("."+top_class);
            spt.selection.set_top(top);
            
            toggle_state = bvr.src_el.getAttribute('toggle');
            if (toggle_state == 'true')
                spt.selection.select_all_items();
            else
                spt.selection.unselect_all_items();

            '''
            } )



        show = IconButtonWdg( tip="Switch View", icon=IconWdg.VIEW, show_arrow=False )
        div.add(show)
        show.add_style("float: right")
        show.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top_class = 'spt_sobject_dir_list_top'
            var top = bvr.src_el.getParent("."+top_class);
            spt.selection.set_top(top);
            var els = top.getElements(".spt_file_dir_item");
            for (var i = 0; i < els.length; i++) {
                var el = els[i];
                if (el.getStyle("display") == "none") {
#.........这里部分代码省略.........
开发者ID:asmboom,项目名称:TACTIC,代码行数:103,代码来源:snapshot_files_wdg.py


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