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


Python SelectWdg.add_class方法代码示例

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


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

示例1: get_display

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

示例2: get_display

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

        top = self.top
        self.set_as_panel(top)
        top.add_class("spt_ingestion_top")
        top.add_color("background", "background", -5)

        self.data = {}

        rules_div = DivWdg()
        top.add(rules_div)
        rules_div.add_style("padding: 10px")

        rules_div.add("Rules: ")

        rules_select = SelectWdg("rule_code")
        rule_code = self.get_value('rule_code')
        if rule_code:
            rules_select.set_value(rule_code)
        rules_select.set_option("query", "config/ingest_rule|code|title")
        rules_select.add_empty_option("-- New --")
        rules_div.add(rules_select)
        rules_select.add_behavior( {
        'type': 'change',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_ingestion_top");
        value = bvr.src_el.value;
        var class_name = 'tactic.ui.tools.IngestionToolWdg';
        spt.panel.load(top, class_name, {rule_code: value} );
        '''
        } )

        rules_div.add("<hr/>")

        # read from the database
        if rule_code:
            search = Search("config/ingest_rule")
            search.add_filter("code", rule_code)
            sobject = search.get_sobject()
        else:
            sobject = None
        if sobject:
            self.data = sobject.get_value("data")
            if self.data:
                self.data = jsonloads(self.data)

        session_code = self.kwargs.get("session_code")
        if session_code:
            session = Search.get_by_code("config/ingest_session", session_code)
        else:
            if sobject:
                session = sobject.get_related_sobject("config/ingest_session")
                print("sobject: ", sobject.get_code(), sobject.get_value("spt_ingest_session_code"))
                print("parent: ", session)
            else:
                session = None


        if not session:
            #session = SearchType.create("config/ingest_session")
            #session.set_value("code", "session101")
            #session.set_value("location", "local")
            ##session.set_value("base_dir", "C:")
            top.add("No session defined!!!")
            return top



        rule = ""
        filter = ""
        ignore = ""


        # get the base path
        if sobject:
            base_dir = sobject.get_value("base_dir")
        else:
            base_dir = ''

        #else:
        #    base_dir = self.get_value("base_dir")
        #if not base_dir:
        #    base_dir = ''

        if sobject:
            title = sobject.get_value("title")
        else:
            title = ''

        if sobject:
            code = sobject.get_value("code")
        else:
            code = ''


        file_list = self.get_value("file_list")
        scan_type = self.get_value("scan_type")
        action_type = self.get_value("action_type")
        rule = self.get_value("rule")
        if not rule:
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:ingestion_wdg.py

示例3: get_display

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

        top = my.top
        top.add_class("spt_ace_editor_top")

        script = my.kwargs.get("custom_script")
        if script:
            language = script.get_value("language")
        else:
            language = my.kwargs.get("language")
            if not language:
                language = 'javascript'

        code = my.kwargs.get("code")
        if not code:
            code = ""


        show_options = my.kwargs.get("show_options")
        if show_options in ['false', False]:
            show_options = False
        else:
            show_options = True

        options_div = DivWdg()
        top.add(options_div)
        if not show_options:
            options_div.add_style("display: none")
        options_div.add_color("background", "background3")
        options_div.add_border()
        options_div.add_style("text-align: center")
        options_div.add_style("padding: 2px")



        select = SelectWdg("language")
        select.add_style("width: 100px")
        select.add_style("display: inline")
        options_div.add(select)
        select.add_class("spt_language")
        select.set_option("values", "javascript|python|expression|xml")
        select.add_behavior( {
            'type': 'change',
            'editor_id': my.get_editor_id(),
            'cbjs_action': '''
            spt.ace_editor.set_editor(bvr.editor_id);
            var value = bvr.src_el.value;
            spt.ace_editor.set_language(value);

            //register_change(bvr);

            '''
        } )
 
        select = SelectWdg("font_size")
        select.add_style("width: 100px")
        select.add_style("display: inline")
        options_div.add(select)
        select.set_option("labels", "8 pt|9 pt|10 pt|11 pt|12 pt|14 pt|16 pt")
        select.set_option("values", "8 pt|9pt|10pt|11pt|12pt|14pt|16pt")
        select.set_value("10pt")
        select.add_behavior( {
            'type': 'click_up',
            'editor_id': my.get_editor_id(),
            'cbjs_action': '''
            spt.ace_editor.set_editor(bvr.editor_id);
            var editor = spt.ace_editor.editor;
            var editor_id = spt.ace_editor.editor_id;

            var value = bvr.src_el.value;
            $(editor_id).setStyle("font-size", value)
            //editor.resize();
            '''
        } )



        select = SelectWdg("keybinding")
        select.add_style("width: 100px")
        #options_div.add(select)
        select.set_option("labels", "Ace|Vim|Emacs")
        select.set_option("values", "ace|vim|emacs")
        select.set_value("10pt")
        select.add_behavior( {
            'type': 'change',
            'editor_id': my.get_editor_id(),
            'cbjs_action': '''
            spt.ace_editor.set_editor(bvr.editor_id);
            var editor = spt.ace_editor.editor;
            var editor_id = spt.ace_editor.editor_id;

            var vim = require("ace/keyboard/keybinding/vim").Vim;
            editor.setKeyboardHandler(vim)
            '''
        } )


        editor_div = DivWdg()
        top.add(editor_div)
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:103,代码来源:shelf_wdg.py

示例4: handle_simple_mode

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def handle_simple_mode(my, custom_table, mode):

        tbody = custom_table.add_tbody()
        tbody.add_class("spt_custom_simple")
        if mode != 'simple':
            tbody.add_style('display: none')


        name_text = TextWdg("custom_name")
        name_text.add_class("spt_input")
        tr = custom_table.add_row()
        tr.add_color("background", "background", -7)
        td = custom_table.add_cell("Name: ")
        td.add_style("min-width: 150px")
        custom_table.add_cell(name_text)


        # add title
        custom_table.add_row()
        title_wdg = TextWdg("custom_title")
        title_wdg.add_attr("size", "50")
        custom_table.add_cell( "Title: " )
        custom_table.add_cell( title_wdg )

        # add description
        tr = custom_table.add_row()
        tr.add_color("background", "background", -7)
        description_wdg = TextAreaWdg("custom_description")
        custom_table.add_cell( "Description: " )
        custom_table.add_cell( description_wdg )


        type_select = SelectWdg("custom_type")
        type_select.add_class("spt_input")
        #type_select.add_empty_option("-- Select --")
        type_select.set_option("values", "string|text|integer|float|boolean|currency|date|foreign_key|list|button|empty")
        type_select.set_option("labels", "String(db)|Text(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key(db)|List(db)|Button|Empty")
        #type_select.set_option("labels", "String|Integer|Boolean|Currency|Timestamp|Link|Foreign Key|List|Checkbox|Text|Number|Date|Date Range")
        tr = custom_table.add_row()
        custom_table.add_cell("Property Type: ")
        td = custom_table.add_cell(type_select)
        type_select.add_event("onchange", "spt.custom_property_adder.property_type_select_cbk(this)")



        # extra info for foreign key
        custom_table.add_row()
        div = DivWdg()
        div.add_class("foreign_key_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Relate to: ")
        search_type_select = SearchTypeSelectWdg("foreign_key_search_select", mode=SearchTypeSelectWdg.CURRENT_PROJECT)
        div.add(search_type_select)
        td.add(div)



        # extra info for list
        custom_table.add_row()
        div = DivWdg()
        div.add_class("list_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Values: ")
        search_type_text = TextWdg("list_values")
        div.add(search_type_text)
        td.add(div)




        # extra info for button
        custom_table.add_row()
        div = DivWdg()
        div.add_class("button_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")

        class_path = "tactic.ui.table.ButtonElementWdg"
        button = Common.create_from_class_path(class_path)
        args_keys = button.get_args_keys()


        div.add("Options")
        div.add(HtmlElement.br())

        for key in args_keys.keys():
            div.add("Name: ")
            option_name_text = TextWdg("option_name")
            option_name_text.add_attr("readonly", "true")
            option_name_text.set_value(key)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:custom_property_wdg.py

示例5: get_new_custom_widget

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_new_custom_widget(my, search_type, view):

        div = DivWdg()
        div.add_style('width: 500px')
        
        mode_select = SelectWdg("custom_mode")
        mode_select.add_class("spt_custom_mode")
        mode_select.set_option("values", "simple|xml")
        mode_select.set_option("labels", "Simple|XML")
        mode_select.add_class("spt_input")
        behavior = {
            'type': 'change',
            'cbfn_action': 'spt.custom_property_adder.switch_property_mode'
        }
        mode_select.add_behavior(behavior)

        div.add("Mode: ")
        div.add(mode_select)
        div.add("<br/><br/>")


        custom_table = Table()
        custom_table.add_color("color", "color")

        custom_table.set_max_width()
        mode = "simple"
        my.handle_simple_mode(custom_table, mode)
        #my.handle_widget_mode(custom_table, mode)
        my.handle_xml_mode(custom_table, mode)
        div.add(custom_table)

        div.add("<br/>")

        custom_table = Table()
        custom_table.center()
        custom_table.add_row()


        from tactic.ui.widget import ActionButtonWdg
        submit = ActionButtonWdg(title="Add/Next")
        behavior = {
            'type': 'click',
            'mouse_btn': 'LMB',
            'cbfn_action': 'spt.custom_property_adder.add_property_cbk',
            'search_type': my.search_type,
            'view': view

        }
        submit.add_behavior(behavior)
        td = custom_table.add_cell(submit)

        behavior['exit'] = 'true'
        submit_exit = ActionButtonWdg(title="Add/Exit")
        submit_exit.add_behavior(behavior)
        custom_table.add_cell(submit_exit)

        cancel = ActionButtonWdg(title="Cancel")
        behavior = {
            'type': 'click_up',
            'cbjs_action': "spt.popup.close('New Table Column')"
        }
        cancel.add_behavior(behavior)
        custom_table.add_cell(cancel)

        div.add(custom_table)

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

示例6: get_set_limit_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_set_limit_wdg(my):
        limit_content = DivWdg()
        limit_content.add_style("font-size: 10px")
        #limit_content.add_style("padding", "5px")
        #limit_content.add_border()

        limit_content.add("Show ")

        limit_select = SelectWdg("limit_select")
        limit_select.add_class("spt_search_limit_select")
        limit_select.set_option("values", "10|20|50|100|200|Custom")
        limit_select.add_style("font-size: 10px")
        limit_content.add(limit_select)
        limit_content.add(" items per page<br/>")

        if my.search_limit in [10,20,50,100,200]:
            limit_select.set_value(my.search_limit)
            is_custom = False
        else:
            limit_select.set_value("Custom")
            is_custom = True

        limit_select.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_search_limit_top");
            var value = bvr.src_el.value;
            var custom = top.getElement(".spt_search_limit_custom");
            if (value == 'Custom') {
                custom.setStyle("display", "");
            }
            else {
                custom.setStyle("display", "none");
            }

            '''
        } )


        custom_limit = DivWdg()
        limit_content.add(custom_limit)
        custom_limit.add_class("spt_search_limit_custom")
        custom_limit.add("<br/>Custom: ")
        text = TextWdg("custom_limit")
        text.add_class("spt_search_limit_custom_text")
        text.add_style("width: 50px")
        if not is_custom:
            custom_limit.add_style("display: none")
        else:
            text.set_value(my.search_limit)
        custom_limit.add(text)
        text.add(" items")
        behavior = {
                'type': 'keydown',
                'cbjs_action': '''
                 if (evt.key=='enter') {
                    // register this as changed item
                    var value = bvr.src_el.value;
                    if (isNaN(value) || value.test(/[\.-]/)) {
                        spt.error('You have to use an integer.');
                    }
                }
        '''}

        
        text.add_behavior(behavior)

        return limit_content
开发者ID:hellios78,项目名称:TACTIC,代码行数:70,代码来源:search_limit_wdg.py

示例7: get_display

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

        # add the detail widget
        detail_wdg = DivWdg(css='spt_detail_panel')
        if not self.name_string and not self.config_string:
            detail_wdg.add("<br/>"*3)
            detail_wdg.add('<- Click on an item on the left for modification.')
            detail_wdg.add_style("padding: 10px")
            detail_wdg.add_color("background", "background", -5)
            detail_wdg.add_style("width: 350px")
            detail_wdg.add_style("height: 400px")
            detail_wdg.add_border()

            return detail_wdg

        if self.kwargs.get("mode") == "empty":
            overlay = DivWdg()
            detail_wdg.add(overlay)

        detail_wdg.add_border()
        detail_wdg.add_color("color", "black")
        detail_wdg.add_style("padding: 10px")
        detail_wdg.add_color("background", "background", -5)

        detail_wdg.set_id('search_type_detail')

        # put in the selection for simple or advanced
        select = SelectWdg("config_mode", label='Mode: ')
        select.set_persistence()
        values = ['simple', 'advanced']
        select.set_option("values", values)
        config_mode = select.get_value()
        #select.add_behavior({"type": "change", "cbjs_action": "spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_simple') )"})
        select.add_behavior({"type": "change", "cbjs_action": \
            "spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_advanced')); %s" %select.get_save_script()})

        select.add_class('spt_config_mode')

        title_div = DivWdg("Column Detail")
        title_div.add_class("maq_search_bar")
        detail_wdg.add(title_div)
        detail_wdg.add("<br/>")
        detail_wdg.add(select)
        detail_wdg.add(HtmlElement.br(2))

        #simple_mode_wdg = WidgetDetailSimpleModeWdg()
        #detail_wdg.add(simple_mode_wdg)
        #detail_wdg.add(HtmlElement.br(2))

        if self.is_new_column:
            detail_wdg.add( self.get_new_definition_wdg() )
        else:
            
            simple_wdg = self.get_simple_definition_wdg()
           
            simple_wdg.add_class("config_simple")
            detail_wdg.add( simple_wdg )
            adv_wdg = self.get_advanced_definition_wdg()
            adv_wdg.add_class("config_advanced")
            if config_mode == 'simple':
                adv_wdg.add_style('display: none')
            detail_wdg.add(HtmlElement.br(2))
            detail_wdg.add( adv_wdg )

        detail_wdg.add(HtmlElement.br(2))


        security_wdg = self.get_security_wdg()
        detail_wdg.add(security_wdg)


        # add hidden input for view for panel refreshing
        # we are only interested in whether it is project_view or definition
        # sub-views of project_view is not of our interest

        #if self.view != 'project_view':
        #    self.view = 'custom_definition'
        detail_wdg.add(HiddenWdg('view', self.view))


        return detail_wdg
开发者ID:mincau,项目名称:TACTIC,代码行数:83,代码来源:search_type_manager_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_display(my):
        # if no filters are defined, then display nothing
        if not my.filters:
            return Widget()

        #filter_top = DivWdg(css="maq_search_bar")
        filter_top = DivWdg()
        filter_top.add_color("color", "color")
        filter_top.add_color("background", "background", -5)
        filter_top.add_style("padding: 5px")
        filter_top.add_style("min-width: 700px")
        filter_top.add_border()
        my.set_as_panel(filter_top)


        # TEST link to help for search widget
        help_button = ActionButtonWdg(title="?", tip="Search Documentation", size='small')
        filter_top.add(help_button)
        help_button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            spt.help.set_top();
            spt.help.load_alias("search-quickstart|what-is-searching|search-interface|search-compound|search-expressions");
            '''
        } )
        help_button.add_style("float: right")


        # this id should be removed
        filter_top.set_id("%s_search" % my.prefix)
        filter_top.add_class("spt_search")


        for name, value in my.kwargs.items():
            filter_top.set_attr("spt_%s" % name, value)

        #filter_top.add(my.statement)
        popup = my.get_retrieve_wdg()
        filter_top.add(popup)
        popup = my.get_save_wdg()
        filter_top.add(popup)

        display = my.kwargs.get('display')
       

        # Add a number of filters indicator
        div = DivWdg()
        div.add_class("spt_search_num_filters")
        div.add_style("float: right")
        div.add_style("font-size: 0.9em")
        div.add_style("margin: 0 10 0 10")
        #search_summary.add(div)
        filter_top.add(div)

        if my.num_filters_enabled:
            msg = "[%s] filter/s" % my.num_filters_enabled
            icon = IconWdg(msg, IconWdg.DOT_GREEN)
            div.add(icon)
            div.add("%s" % msg)


        filter_div = DivWdg()
        filter_div.set_id("search_filters")
        filter_div.add_class("spt_search_filters")


        # TODO: disabling for now
        # add the action buttons
        #action_wdg =  my.get_action_wdg()
        #action_wdg.add_style("text-align: right")
        #filter_div.add( action_wdg )
        # add the top
        display_str = 'block'
        if not display:
            display_str = 'none'
        filter_div.add_style("display: %s" % display_str)

        search_wdg = my.get_search_wdg()

        prefix = "filter_mode"
        if my.prefix_namespace:
            prefix = '%s_%s' %(my.prefix_namespace, prefix)
        hidden = HiddenWdg("prefix", prefix)

        match_div = DivWdg()
        match_div.add(hidden)
        match_div.add_class('spt_search_filter') 

        palette =  match_div.get_palette()
        bg_color = palette.color('background')
        light_bg_color =  palette.color('background', modifier=+10)
        

        select = SelectWdg("filter_mode")
        select.add_class("spt_search_filter_mode")
        select.set_persist_on_submit(prefix)
        select.remove_empty_option() 
        # for Local search, leave out compound search for now
        if my.kwargs.get('prefix_namespace'):
            select.set_option("labels", "Match all|Match any")
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:103,代码来源:search_wdg.py

示例9: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_display(my):
        top = DivWdg()
        top.add_class("spt_element_top")

        prefix = my.kwargs.get('prefix')
        # this should be name to be consistent with the BaseInputWdg interface
        widget_name = my.kwargs.get('name')
        if not widget_name:
            widget_name = 'data_type'

        display_options = my.kwargs.get('display_options')
        if not display_options:
            display_options = {}

        option = my.kwargs.get('option')
        if not option:
            option = {}



        # get the current value
        option_name = option.get('name')
        widget_type = display_options.get(option_name)

        select = SelectWdg(widget_name)
        top.add(select)
        default = option.get('default')
        if default:
            select.set_value(default)
        else:
            select.add_empty_option('-- Select --')

        values = option.get('values')
        if not values:
            values = 'integer|float|percent|currency|date|time|scientific|boolean|text|timecode',
        select.set_option('values', values)


        if widget_type:
            select.set_value(widget_type)

        select.add_behavior( {
        'type': 'change',
        'cbjs_action': '''
        var value = bvr.src_el.value;
        var top = bvr.src_el.getParent(".spt_element_top");
        var selects = top.getElements(".spt_format");
        for (var i = 0; i < selects.length; i++) {
            var type = selects[i].getAttribute("spt_type");
            if (value == type) {
                selects[i].setStyle("display", "");
                selects[i].removeAttribute("disabled");
            }
            else {
                selects[i].setStyle("display", "none");
                selects[i].setAttribute("disabled", "disabled");
                selects[i].value = '';

            }
        }
        '''
        } )


        selects_values = {
            '':             [],
            'integer':      ['-1234',
                             '-1,234'],

            'float':        ['-1234.12',
                             '-1,234.12'],

            'percent':      ['-13%', 
                             '-12.95%'],

            'currency':     ['-$1,234',
                             '-$1,234.00',
                             '-$1,234.--',
                             '-1,234.00 CAD',
                             '($1,234.00)',
                             ],

            'date':         ['31/12/99',
                             'December 31, 1999',
                             '31/12/1999',
                             'Dec 31, 99', 
                             'Dec 31, 1999',
                             '31 Dec, 1999',
                             '31 December 1999',
                             'Fri, Dec 31, 99',
                             'Fri 31/Dec 99',
                             'Fri, December 31, 1999',
                             'Friday, December 31, 1999',
                             '12-31',
                             '99-12-31',
                             '1999-12-31',
                             '12-31-1999',
                             '12/99',
                             '31/Dec',
                             'December',
#.........这里部分代码省略.........
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:103,代码来源:format_definition_wdg.py

示例10: get_install_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_install_wdg(self, server_code, project_code):

        div = DivWdg()
        div.add_style("padding: 30px")
        div.add_style("margin: 10px")
        div.add_border()
        div.add_style("width: 300px")
        div.add_class("spt_sync_install_top")
        div.add_color("background", "background3")


        server = Search.get_by_code("sthpw/sync_server", server_code)
        if not server:
            div.add("No server [%s] exists in this installation" % server_code)
            return div

        if server.get_value("sync_mode") == "file":
            base_dir = server.get_value("base_dir")
        else:
            div.add("No base directory defined")
            return div


        if not os.path.exists(base_dir):
            div.add("Base Directory [%s] does not exist" % base_dir)
            return div



        dirnames = os.listdir(base_dir)
        templates_set = set()
        for dirname in dirnames:
            if dirname.endswith(".zip"):
                if dirname.find("_template-") != -1:
                    parts = dirname.split("_template-")
                    templates_set.add(parts[0])
                

        project_codes = list(templates_set)
        project_codes.sort()

        if not project_codes:
            div.add("There are no templates available.<br/><br/>")


        else:

            div.add("This will import a project template that has been dumped out.  The project cannot currently exist in the database.<br/><br/>")


            div.add("Available Templates: ")
            text_wdg = SelectWdg("server")
            text_wdg.set_option("values", project_codes)
            if project_code:
                text_wdg.set_value(project_code)
            text_wdg.add_class("spt_project")
            div.add(text_wdg)

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

            # This will create a project template dynamically and provide it for
            # download?
            button = ActionButtonWdg(title="Install")
            div.add(button)
            button.add_style("margin-left: auto")
            button.add_style("margin-right: auto")
            button.add_behavior( {
                'type': 'click_up',
                'server': server_code,
                'project_code': project_code,
                'cbjs_action': '''
                var top = bvr.src_el.getParent(".spt_sync_install_top");
                var text = top.getElement(".spt_project");
                var project_code = text.value ;

                spt.app_busy.show("Importing Project", "from remote server ["+bvr.server+"].");

                try {
                    var cmd = 'tactic.ui.sync.SyncRemoteProjectCmd';
                    var kwargs = {
                        'server': bvr.server,
                        'project_code': project_code
                    }
                    var server = TacticServerStub.get();
                    server.execute_cmd(cmd, kwargs);
                }
                catch(e) {
                    alert("Error importing project: " + e);
                }
                spt.app_busy.hide();
                '''
            } )

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

示例11: get_dump_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_dump_wdg(self, server_code, project_code):

        div = DivWdg()
        div.add_style("padding: 30px")
        div.add_style("margin: 10px")
        div.add_border()
        div.add_style("width: 300px")
        div.add_class("spt_sync_dump_top")
        div.add_color("background", "background3")



        # Dump Project

        search = Search("sthpw/project")
        search.add_filters("code", ["admin","unittest"], op='not in')
        projects = search.get_sobjects()
        project_codes = [x.get_code() for x in projects]


        div.add("This will dump out the current state of the project and can be reimported back in on a remote server<br/><br/>")

        div.add("Project: ")
        text_wdg = SelectWdg("project_to_dump")
        text_wdg.add_empty_option("-- Select --")
        text_wdg.set_option("values", project_codes)
        if project_code:
            text_wdg.set_value(project_code)
        text_wdg.add_class("spt_project")
        div.add(text_wdg)

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


        button = ActionButtonWdg(title="Dump")
        div.add(button)
        button.add_style("margin-left: auto")
        button.add_style("margin-right: auto")
        button.add_behavior( {
            'type': 'click_up',
            'server': server_code,
            'project_code': project_code,
            'cbjs_action': '''

            var top = bvr.src_el.getParent(".spt_sync_dump_top");
            var text = top.getElement(".spt_project");
            var project_code = text.value;


            if (!project_code) {
                spt.alert("No project specified");
                return
            }

            spt.app_busy.show("Dumping "+project_code+" Project ...") ;

            var cmd = 'tactic.ui.sync.SyncCreateTemplateCmd';
            var server = TacticServerStub.get();

            var kwargs = {
                'server': bvr.server,
                'project_code': project_code
            }
            server.execute_cmd(cmd, kwargs);

            var top = bvr.src_el.getParent(".spt_sync_settings_top");
            spt.panel.refresh(top);

            spt.app_busy.hide();

            '''
        } )


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

示例12: get_display

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

        search_type = self.kwargs.get("search_type")

        div = self.top

        div.add("List of Saved Searches: ")
        div.add(HtmlElement.br(2))
        div.add_style("margin: 20px")
        div.add_style("width: 400px")
        div.add_class("spt_saved_search_top")
        
        try:
            search = Search("config/widget_config")
            search.add_op("begin")
            search.add_filter("view", 'saved_search:%', op="like")
            search.add_filter("category", 'search_filter')
            search.add_op("or")
            search.add_op("begin")
            search.add_user_filter()
            search.add_filter("login", "NULL", op="is", quoted=False)
            search.add_op("or")
            search.add_filter("search_type", search_type)
            configs = search.get_sobjects()
        except SearchException as e:
            print("WARNING: ", e)
            configs = []
        except:
            SearchWdg.clear_search_data(search_type)
            raise

        """
        from tactic.ui.panel import TableLayoutWdg
        element_names = ['view','name','description','delete']
        table = TableLayoutWdg(
                search_type=search_type,
                element_names=element_names,
                search=search,
                show_shelf=False,
                show_border=False,
                show_search_limit=False,
                height="auto",

        )
        div.add(table)
        """

        values = [x.get("view") for x in configs]
        labels = [x.get("title") or x.get("view") for x in configs]

        select = SelectWdg("saved_search")
        div.add(select)
        select.set_id("saved_search")
        select.add_class("spt_saved_search_input")
        select.add_empty_option("-- Select --")
        select.set_option("values", values)
        select.set_option("labels", labels)

        retrieve_button = ActionButtonWdg(title="Load")
        behavior = {
            'type':         'click',
            #'cbjs_action':  'spt.dg_table.retrieve_search_cbk(evt, bvr);'
            'cbjs_action':  '''
            var top = bvr.src_el.getParent(".spt_saved_search_top")
            var input = top.getElement(".spt_saved_search_input");
            var value = input.value;
            if (!value) {
                spt.alert("Please select a saved search to load.");
                return;
            }

            var popup = bvr.src_el.getParent(".spt_popup");
            var activator = popup.activator;
            var layout = activator.getElement(".spt_layout");
            spt.table.set_layout(layout);

            spt.table.load_search(value);
            '''
        }
        retrieve_button.add_behavior( behavior )
        retrieve_button.add_style("display: inline-block")


        remove_button = ActionButtonWdg(title="Remove")
        remove_button.add_behavior( {
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_saved_search_top")
            var input = top.getElement(".spt_saved_search_input");
            var value = input.value;
            if (!value) {
                spt.alert("Please select a saved search to remove.");
                return;
            }

            spt.alert("Remove: " + value);



            '''
        } )
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:search_wdg.py

示例13: get_data_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import add_class [as 别名]
    def get_data_wdg(my):
        div = DivWdg()

        from pyasm.biz import Pipeline
        from pyasm.widget import SelectWdg
        search_type_obj = SearchType.get(my.search_type)
        base_type = search_type_obj.get_base_key()
        search = Search("sthpw/pipeline")
        search.add_filter("search_type", base_type)
        pipelines = search.get_sobjects()
        if pipelines:
            pipeline = pipelines[0]

            process_names = pipeline.get_process_names()
            if process_names:
                table = Table()
                div.add(table)
                table.add_row()
                table.add_cell("Process: ")
                select = SelectWdg("process")
                table.add_cell(select)
                process_names.append("---")
                process_names.append("publish")
                process_names.append("icon")
                select.set_option("values", process_names)
        


        ####
        buttons = Table()
        div.add(buttons)
        buttons.add_row()


        #button = IconButtonWdg(title="Fill in Data", icon=IconWdg.EDIT)
        button = ActionButtonWdg(title="Metadata")
        button.add_style("float: left")
        button.add_style("margin-top: -3px")
        buttons.add_cell(button)
        
        select_label = DivWdg("Update mode");
        select_label.add_style("float: left")
        select_label.add_style("margin-top: -3px")
        select_label.add_style("margin-left: 20px")
        buttons.add_cell(select_label)
        
        update_mode_option = my.kwargs.get("update_mode")
        if not update_mode_option:
            update_mode_option = "true"
        update_mode = SelectWdg(name="update mode")
        update_mode.add_class("spt_update_mode_select")
        update_mode.set_option("values", ["false", "true", "sequence"])
        update_mode.set_option("labels", ["Off", "On", "Sequence"])
        update_mode.set_option("default", update_mode_option)
        update_mode.add_style("float: left")
        update_mode.add_style("margin-top: -3px")
        update_mode.add_style("margin-left: 5px")
        update_mode.add_style("margin-right: 5px")
        buttons.add_cell(update_mode)

        update_info = DivWdg()
        update_info.add_class("glyphicon")
        update_info.add_class("glyphicon-info-sign")
        update_info.add_style("float: left")
        update_info.add_style("margin-top: -3px")
        update_info.add_style("margin-left: 10px")
        update_info.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            spt.info("When update mode is on, if a file shares the name of one other file in the asset library, the file will update on ingest. If more than one file shares the name of an ingested asset, a new asset is created.<br> If sequence mode is selected, the system will update the sobject on ingest if a file sequence sharing the same name already exists.", {type: 'html'});
            '''
        } )
        buttons.add_cell(update_info);
 
        dialog = DialogWdg(display="false", show_title=False)
        div.add(dialog)
        dialog.set_as_activator(button, offset={'x':-10,'y':10})

        dialog_data_div = DivWdg()
        dialog_data_div.add_color("background", "background")
        dialog_data_div.add_style("padding", "20px")
        dialog.add(dialog_data_div)


        # Order folders by date
        name_div = DivWdg()
        dialog_data_div.add(name_div)
        name_div.add_style("margin: 15px 0px")

        if SearchType.column_exists(my.search_type, "relative_dir"):

            category_div = DivWdg()
            name_div.add(category_div)
            checkbox = RadioWdg("category")
            checkbox.set_option("value", "none")
            category_div.add(checkbox)
            category_div.add(" No categories")
            category_div.add_style("margin-bottom: 5px")
            checkbox.set_option("checked", "true")

#.........这里部分代码省略.........
开发者ID:asmboom,项目名称:TACTIC,代码行数:103,代码来源:ingest_wdg.py


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