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


Python widget.ActionButtonWdg类代码示例

本文整理汇总了Python中tactic.ui.widget.ActionButtonWdg的典型用法代码示例。如果您正苦于以下问题:Python ActionButtonWdg类的具体用法?Python ActionButtonWdg怎么用?Python ActionButtonWdg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: get_checkin

    def get_checkin(my):
        '''the button which initiates the checkin'''
        # create the button with the javascript function
        widget = Widget()
        #button = TextBtnWdg(label=my.PUBLISH_BUTTON, size='large', width='100', side_padding='20', vert_offset='-5')
        #button.get_top_el().add_class('smaller')
        button = ActionButtonWdg(title=my.PUBLISH_BUTTON, tip='Publish the selected assets')
        button.add_style('margin-bottom: 10px')
        #button.add_color("background", "background")

        hidden = HiddenWdg(my.PUBLISH_BUTTON, '')
        button.add( hidden )
       
        '''
        status_sel = SelectWdg('checkin_status', label='Status: ')
        status_sel.set_option('setting', 'checkin_status')
        status_sel.set_persist_on_submit()
        status_sel.add_empty_option('-- Checkin Status --')
        widget.add(status_sel)
        '''
        widget.add(button)

        # custom defined 
        server_cbk = "pyasm.prod.web.AssetCheckinCbk"
        #TODO: make other Publish Buttons call their own handle_input function
        exec( Common.get_import_from_class_path(server_cbk) )
        exec( "%s.handle_input(button, my.search_type, my.texture_search_type)" % server_cbk)

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

示例2: get_save_button

    def get_save_button(my,checkin_keys):
        save_button = ActionButtonWdg(title="Save >>", tip="Save configuration and start using TACTIC")
   
        save_button.add_style("float: right")
        save_button.add_behavior( {
            'type': 'click_up',
            'os' : os.name, 
            'checkin_options':checkin_keys,
            'cbjs_action': '''
            
            var top = bvr.src_el.getParent(".spt_db_config_top");
            var failed_els = top.getElements('.spt_input_validation_failed')
            if (failed_els.length > 0){
                spt.alert('One of the fields fail validation. Please correct it before saving')
                return;
            }
            spt.app_busy.show("Saving configuration. Please wait...")
            var values = spt.api.Utility.get_input_values(top, null, false);
            var class_name = 'tactic.ui.startup.DbConfigSaveCbk';
            var server = TacticServerStub.get();
            var kwargs = {checkin_options:bvr.checkin_options};
            try {
                var ret_val = server.execute_cmd(class_name, kwargs, values);
                var info = ret_val.info;
            }
            catch(e) {
                log.critical(spt.exception.handler(e));
                //FIXME: recognize it's a 502 which is normal and pass , otherwise throw the error
                //spt.error(spt.exception.handler(e));
                //spt.app_busy.hide();
                //return;
            }

           
            
            // This means TACTIC was restarted
            
            if (typeof(info) == 'undefined' || bvr.os == 'nt' ) {
                spt.app_busy.show("Restarting TACTIC ...");
                var id = setInterval( function() {
                    var ping_rtn =  server.ping();
                    if (ping_rtn) {
                        window.location = '/tactic';
                        clearInterval(id);
                    }
                  
                }, 5000 );

            }
            else if (info.error) {
                spt.alert(info.error);
                spt.app_busy.hide();
            }
            else {
                window.location = '/tactic';
            }

            '''
            } )
        return save_button
开发者ID:0-T-0,项目名称:TACTIC,代码行数:60,代码来源:db_config_wdg.py

示例3: get_advanced_definition_wdg

    def get_advanced_definition_wdg(self):
        # add the advanced entry
        advanced = DivWdg()
        advanced.add_style("margin-top: 10px")
        advanced.add_style("padding: 10px")
        advanced.add_border()
        title = DivWdg()
        title.add_style("color: black")
        title.add("Advanced - XML Column Definition")
        title.add_style("margin-top: -23")
        advanced.add(title)
        advanced.add("<br/>")

        input = TextAreaWdg("config_xml")
        input.set_id("config_xml")
        input.set_option("rows", "10")
        input.set_option("cols", "70")
        input.set_value(self.config_string)
        advanced.add(input)
        advanced.add(HtmlElement.br(2))

        button_div = DivWdg()
        button_div.add_style("text-align: center")
        

        button = ActionButtonWdg(title="Save Definition") 
        #button = ProdIconButtonWdg("Save Definition")
        button.add_event("onclick", "spt.custom_project.save_definition_cbk()")
        button_div.add(button)
        button_div.add_style("margin-left: 130px")
        advanced.add(button_div)

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

示例4: handle_python_script_test

    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
开发者ID:mincau,项目名称:TACTIC,代码行数:30,代码来源:system_info_wdg.py

示例5: get_tools_wdg

    def get_tools_wdg(my):

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

        div.add("This tool will export out a version of the project")

        button = ActionButtonWdg(title="Export")
        div.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'server': my.server_code,
            'cbjs_action': '''
            var class_name = 'tactic.ui.sync.SyncCreateTemplateCmd';
            var kwargs = {
                server: bvr.server
            }
            spt.app_busy.show("Exporting project ...");
            var server = TacticServerStub.get();
            server.execute_cmd(class_name, kwargs);
            spt.app_busy.hide();

            spt.panel.refresh(bvr.src_el);

            '''
        } )



        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:31,代码来源:share_wdg.py

示例6: get_search_wdg

    def get_search_wdg(self):
        search_div = DivWdg()

        if self.kwargs.get('run_search_bvr'):
            run_search_bvr = self.kwargs.get('run_search_bvr')
        else:
            run_search_bvr = {
                'type':         'click_up',
                'cbjs_action':  '''
                spt.simple_search.hide();
                spt.dg_table.search_cbk(evt, bvr);
                ''',
                'new_search':   True,
                'panel_id':     self.prefix
            }


        title = "Apply"

        button = ActionButtonWdg(title=title, tip='Run search with this criteria' )
        search_div.add(button)
        #button.add_style("margin-top: -7px")
        button.add_behavior( run_search_bvr )

        return search_div
开发者ID:mincau,项目名称:TACTIC,代码行数:25,代码来源:simple_search_wdg.py

示例7: handle_load_balancing

    def handle_load_balancing(self, top):
        # deal with asset directories
        top.add(DivWdg('Load Balancing', css='spt_info_title'))
        table = Table()
        table.add_class("spt_loadbalance")
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        top.add(table)
        table.add_row()
        td = table.add_cell("Load Balancing: ")
        td.add_style("width: 150px")

        button = ActionButtonWdg(title='Test')
        td = table.add_cell(button)
        message_div = DivWdg()
        message_div.add_class("spt_loadbalance_message")
        table.add_cell(message_div)
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var server = TacticServerStub.get()
        var ports = {};
        var count = 0;
        for (var i = 0; i < 50; i++) {
          var info = server.get_connection_info();
          var port = info.port;
          var num = ports[port];
          if (!num) {
            ports[port] = 1;
            count += 1;
          }
          else {
            ports[port] += 1;
          }
          // if there are 10 requests and still only one, then break
          if (i == 10 && count == 1)
            break;
        }


        // build the ports string
        x = [];
        for (i in ports) {
            x.push(i);
        }
        x.sort();
        x = x.join(", ");

        var loadbalance_el = bvr.src_el.getParent(".spt_loadbalance");
        var message_el = loadbalance_el.getElement(".spt_loadbalance_message");
        if (count > 1) {
            var message = "Yes (found " + count + " ports: "+x+")";
        }
        else {
            var message = "<blink style='background: red; padding: 3px'>Not enabled (found only port " + x + ")</blink>";
        }
        message_el.innerHTML = message
        '''
        } )
开发者ID:mincau,项目名称:TACTIC,代码行数:59,代码来源:system_info_wdg.py

示例8: get_display

    def get_display(self):

        top = self.top

        upload = Html5UploadWdg(name="formxyz")
        top.add(upload)
        upload_id = upload.get_upload_id()

        color = self.kwargs.get("color")
        width = self.kwargs.get("width")

        from tactic.ui.widget import ActionButtonWdg
        button = ActionButtonWdg(title="Upload", color=color, width=width)
        top.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'upload_id': upload_id,
            'cbjs_action': '''

            // set the form
            spt.html5upload.form = $(bvr.upload_id);

            // set an action for completion
            var upload_complete = function(evt) {
                var search_key = "sthpw/login?code=admin";
                var server = TacticServerStub.get();
                var file = spt.html5upload.get_file();
                if (file) {
                   file_name = file.name;
                     
                   server.simple_checkin(search_key, "icon", file_name, {mode:'uploaded'});
                }
                else 
                  alert('Error: file object cannot be found.')

            }

            var upload_progress = function(evt) {
                var percent = Math.round(evt.loaded * 100 / evt.total);
            }

            var onchange = function () {
                spt.html5upload.upload_file( {
                  upload_complete: upload_complete,
                  upload_progress: upload_progress 
                } );
            }


  
            spt.html5upload.select_file( onchange);

            '''
        } )

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

示例9: get_error_wdg

    def get_error_wdg(my):
        div = DivWdg()
        error_div = DivWdg()
        error_div.add("Error %s" % my.status)
        div.add(error_div)
        error_div.add_style("font-size: 18px")
        error_div.add_style("font-weight: bold")
        error_div.add_style("padding: 10px")
        error_div.add_style("width: auto")
        error_div.add_gradient("background", "background")
        error_div.add_border()
        error_div.add_style("margin-left: 5px")
        error_div.add_style("margin-right: 5px")
        error_div.add_style("margin-top: -10px")

        div.add("<br/>")


        span = DivWdg()
        #span.add_color("color", "color")
        span.add_style("color", "#FFF")
        if my.status == 404:
            span.add(HtmlElement.b("You have tried to access a url that is not recognized."))
        else:
            span.add(HtmlElement.b(my.message))
        span.add(HtmlElement.br(2))

        web = WebContainer.get_web()
        root = web.get_site_root()
        if my.message.startswith('No project ['):
            label = 'You may need to correct the default_project setting in the TACTIC config.'
        else:
            label = "Go to the Main page for a list of valid projects"
        span.add(label)
        div.add(span)
        div.add(HtmlElement.br())

        from tactic.ui.widget import ActionButtonWdg
        button_div = DivWdg()
        button_div.add_style("width: 90px")
        button_div.add_style("margin: 0px auto")

        div.add(button_div)
        button = ActionButtonWdg(title="Go to Main", tip='Click to go to main page')
        button_div.add(button)
        
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        document.location = '/';
        '''
        } )
        button.add_event("onmouseup", "document.location='/'")

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

示例10: get_display

    def get_display(my):
        top = DivWdg()
     
        top.add_style("width: 100%")
        top.add_color("background", "background", -10)
        top.add_style("padding-top: 30px")
        top.add_style("padding-bottom: 50px")
        top.add_class("twog_wizard_top")

        inner = DivWdg()
        top.add(inner)

        # set the width and height here
        inner.add_style("width: 800px")
        inner.add_style("min-height: 600px")
        inner.add_style("float: center")
        inner.add_border()
        inner.center()
        inner.add_style("padding: 20px")
        inner.add_color("background", "background")


        from tactic.ui.container import WizardWdg


        title = DivWdg()
        title.add("Step 1")

        wizard = WizardWdg(title=title)
        my.wizard = wizard
        inner.add(wizard)


        help_button = ActionButtonWdg(title="?", tip="Step 1 Help", size='s')
        title.add(help_button)
        help_button.add_style("float: right")
        help_button.add_style("margin-top: -20px")
        help_button.add_style("margin-right: -10px")
        help_button.add_behavior({
            'type': 'click_up',
            'cbjs_action': '''
            spt.help.set_top();
            spt.help.load_alias("order_wdg");
            '''
        })

        page_one = my.get_page_one()
        wizard.add(page_one, 'Step 1')
        page_two = my.get_page_two()
        wizard.add(page_two, 'Step 2')
        page_three = my.get_page_three()
        wizard.add(page_three, 'Step 3')
        page_four = my.get_page_four()
        wizard.add(page_four, 'Step 4')


        return top
开发者ID:2gDigitalPost,项目名称:custom,代码行数:57,代码来源:order_entry_wdg.py

示例11: get_display

    def get_display(my):
         
        search_key = ''
        sobj = my.get_current_sobject()

        top = DivWdg() 
        top.add_style("padding-top: 5px")

        span = ActionButtonWdg(title="Email Test")
        #span = ProdIconButtonWdg('Email Test')
        top.add(span)
        span.add_behavior(my.get_behavior(sobj))


        return top
开发者ID:funic,项目名称:TACTIC,代码行数:15,代码来源:table_element_wdg.py

示例12: get_add_chat_wdg

    def get_add_chat_wdg(my):

        div = DivWdg()
        div.add_border()
        div.add_style("padding: 20px")
        div.add_class("spt_add_chat_top")

        table = Table()
        table.add_style("width: auto")
        div.add(table)
        table.add_row()

        text = TextInputWdg(title="user", icon="USER_ADD")
        table.add_cell(text)
        text.add_class("spt_add_chat_user")


        add_button = ActionButtonWdg(title="Start Chat")
        table.add_cell(add_button)
        add_button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_add_chat_top");
            var el = top.getElement(".spt_add_chat_user");
            var user = el.value;
            if (!user) {
                alert("Specify a valid user to chat with");
                return;
            }

            // new chat
            var server = TacticServerStub.get();
            var category = "chat";

            var class_name = 'tactic.ui.app.ChatCmd';
            var kwargs = {
                users: [user]
            }
            server.execute_cmd(class_name, kwargs);

            spt.panel.refresh(bvr.src_el);
            '''
        } )

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

示例13: get_search_wdg

    def get_search_wdg(my):
        search_div = DivWdg()

        if my.kwargs.get('run_search_bvr'):
            run_search_bvr = my.kwargs.get('run_search_bvr')
        else:
            run_search_bvr = {
                'type':         'click_up',
                'cbjs_action':  'spt.dg_table.search_cbk(evt, bvr)',
                'new_search':   True,
                'panel_id':     my.prefix
            }

        button = ActionButtonWdg(title='Search', tip='Run search with this criteria' )
        search_div.add(button)
        #button.add_style("margin-top: -7px")
        button.add_behavior( run_search_bvr )

        return search_div
开发者ID:funic,项目名称:TACTIC,代码行数:19,代码来源:simple_search_wdg.py

示例14: get_save_button

    def get_save_button(my,checkin_keys):
        save_button = ActionButtonWdg(title="Save >>", tip="Save configuration and start using TACTIC")
   
        save_button.add_style("float: right")
        save_button.add_behavior( {
            'type': 'click_up',
            'os' : os.name, 
            'checkin_options':checkin_keys,
            'cbjs_action': '''
            spt.app_busy.show("Saving configuration. Please wait...")
            var top = bvr.src_el.getParent(".spt_db_config_top");
            var values = spt.api.Utility.get_input_values(top, null, false);
            var class_name = 'tactic.ui.startup.DbConfigSaveCbk';
            var server = TacticServerStub.get();
            var kwargs = {checkin_options:bvr.checkin_options};

            var ret_val = server.execute_cmd(class_name, kwargs, values);
            var info = ret_val.info;
            
            // This means TACTIC was restarted
            if (typeof(info) == 'undefined' || bvr.os == 'nt' ) {
                spt.app_busy.show("Restarting TACTIC ...");
                var id = setInterval( function() {
                    var ping_rtn =  server.ping();
                    if (ping_rtn) {
                        window.location = '/tactic';
                        clearInterval(id);
                    }
                  
                }, 5000 );

            }
            else if (info.error) {
                spt.alert(info.error);
            }
            else {
                window.location = '/tactic';
            }
            '''
            } )
        return save_button
开发者ID:blezek,项目名称:TACTIC,代码行数:41,代码来源:db_config_wdg.py

示例15: handle_sidebar_clear

 def handle_sidebar_clear(self, top):
     top.add(DivWdg('Clear Side Bar Cache ', css='spt_info_title'))
     table = Table()
     table.add_color("color", "color")
     table.add_style("margin: 10px")
     top.add(table)
     table.add_row()
     td = table.add_cell("Clear the Side Bar Cache for all users")
     td.add_style("width: 250px")
     button = ActionButtonWdg(title='Run')
     table.add_cell(button)
     button.add_behavior( {
     'type': 'click_up',
     'cbjs_action': '''
         try {
         var s = TacticServerStub.get();
         s.execute_cmd('tactic.ui.app.ClearSideBarCache');
         
         } catch(e) {
             spt.alert(spt.exception.handler(e));
         }
         spt.info('Side Bar cache cleared.')
     '''
     })
开发者ID:mincau,项目名称:TACTIC,代码行数:24,代码来源:system_info_wdg.py


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