• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python widget.ActionButtonWdg类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_display

    def get_display(my):

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

        title = my.kwargs.get("title")
        name = my.kwargs.get("name")

        if not name:
            name = "upload"

        if not title:
            title = Common.get_display_title(name)

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


        hidden = HiddenWdg(name)
        top.add(hidden)


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

       
        if my.upload_id:
            upload_id = my.upload_id
        else:
            upload = Html5UploadWdg(name=name, multiple=multiple)
            top.add(upload)
            upload_id = upload.get_upload_id()



        from tactic.ui.widget import ActionButtonWdg
        button = ActionButtonWdg(title=title)


        button_id = my.kwargs.get("id")
        if button_id:
            button.set_id(button_id)
        top.add(button)

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



        upload_start = my.kwargs.get("upload_start")
        if not upload_start:
            upload_start = '''
            var top = bvr.src_el.getParent(".spt_upload_top");
            var hidden = top.getElement(".spt_input");
            var file = spt.html5upload.get_file();
            if (!file) {
               return;
            }
            hidden.value = file.name;
            '''
 
        on_complete = my.get_on_complete()
        if not on_complete:
            on_complete = '''
            var files = spt.html5upload.get_files();
            if (files.length == 0) {
               alert('Error: files cannot be found.')
               spt.app_busy.hide();
               return;
            }

            spt.notify.show_message("Uploaded "+files.length+" files");
            spt.app_busy.hide();
            '''

        upload_progress = my.kwargs.get("upload_progress")
        if not upload_progress:
            upload_progress = '''
            var percent = Math.round(evt.loaded * 100 / evt.total);
            spt.app_busy.show("Uploading ["+percent+"%% complete]");
            '''

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


        button.add_behavior( {
            'type': 'click_up',
            'upload_id': upload_id,
            'search_key': search_key,
            'ticket': my.ticket,
            'multiple': multiple,
            'kwargs': my.on_complete_kwargs,
            'cbjs_action': '''
            var search_key = bvr.search_key;

#.........这里部分代码省略.........
开发者ID:makeittotop,项目名称:python-scripts,代码行数:101,代码来源:html5_upload_wdg.py


示例17: get_display


#.........这里部分代码省略.........

        content.add("<br/>"*2)
        content.add("<b>Do you wish to continue deleting? </b>")
        radio = RadioWdg("mode")
        radio.add_class("spt_mode_radio")
        radio.set_value("delete")
        radio.add_style("margin-left: 15")
        radio.add_style("margin-top: 5")
        content.add(radio)
        content.add("<br/>"*3)

        #content.add("<b>Or do you just wish to retire the project? </b>")
        #radio = RadioWdg("mode")
        #radio.add_class("spt_mode_radio")
        #radio.set_value("retire")
        #content.add(radio)
        #content.add(radio)

        #content.add("<br/>"*2)


        #button = ActionButtonWdg(title="Retire")
        #content.add(button)
        #button.add_style("float: left")

        buttons = Table()
        content.add(buttons)
        buttons.add_row()
        buttons.add_style("margin-left: auto")
        buttons.add_style("margin-right: auto")
        buttons.add_style("width: 250px")


        button = ActionButtonWdg(title="Delete", color="danger")
        buttons.add_cell(button)

        command_class = self.kwargs.get("command_class")
        if not command_class:
            command_class = 'tactic.ui.tools.DeleteProjectCmd'

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

        button.add_behavior( {
        'type': 'click_up',
        #'search_type': search_type,
        'project_code': project_code,
        'site': site,
        'related_types': related_types,
        'command_class': command_class,
        'on_complete': on_complete,
        'cbjs_action': '''
            spt.app_busy.show("Deleting");
            var class_name = bvr.command_class;
            var kwargs = {
                'site': bvr.site,
                'project_code': bvr.project_code,
                'related_types': bvr.related_types
            };

            var top = bvr.src_el.getParent(".spt_delete_project_tool_top");
            var radios = top.getElements(".spt_mode_radio");

            //if (!radios[0].checked && !radios[1].checked) {
            if (!radios[0].checked) {
                spt.alert("Please confirm the delete by checking the radio button.");
                spt.app_busy.hide();
开发者ID:mincau,项目名称:TACTIC,代码行数:67,代码来源:delete_wdg.py


示例18: get_display

    def get_display(my):


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

        div = DivWdg()
        div.add_class("spt_ingest_top")
        div.add_style("width: 100%px")
        div.add_style("min-width: 500px")
        div.add_style("padding: 20px")
        div.add_color("background", "background")


        title_div = DivWdg()
        div.add(title_div)
        title_div.add("Ingest Files")
        title_div.add_style("font-size: 14px")
        title_div.add_style("font-weight: bold")
        title_div.add_style("padding: 10px")
        title_div.add_color("background", "background3")
        title_div.add_border()

        my.search_type = my.kwargs.get("search_type")
        if not my.search_type:
            div.add("No search type specfied")
            return div

        if relative_dir:
            folder_div = DivWdg()
            div.add(folder_div)
            folder_div.add("Folder: %s" % relative_dir)
            folder_div.add_style("opacity: 0.5")
            folder_div.add_style("font-style: italic")
            folder_div.add_style("margin-bottom: 10px")

            title_div.add_style("margin: -20px -21px 5px -21px")
        else:
            title_div.add_style("margin: -20px -21px 15px -21px")


        div.add("Add files or drag/drop files to be uploaded and ingested:")
        div.add("<br/>"*2)


        data_div = my.get_data_wdg()
        data_div.add_style("float: left")
        data_div.add_style("float: left")
        div.add(data_div)

        # create the help button
        help_button_wdg = DivWdg()
        div.add(help_button_wdg)
        help_button_wdg.add_style("margin-top: -3px")
        help_button_wdg.add_style("float: right")
        help_button = ActionButtonWdg(title="?", tip="Ingestion Widget Help", size='s')
        help_button_wdg.add(help_button)

        help_button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''spt.help.load_alias("ingestion_widget")'''
        } )

        from tactic.ui.input import Html5UploadWdg
        upload = Html5UploadWdg(multiple=True)
        div.add(upload)


        button = ActionButtonWdg(title="Add")
        button.add_style("float: right")
        button.add_style("margin-top: -3px")
        div.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''

            var top = bvr.src_el.getParent(".spt_ingest_top");
            var files_el = top.getElement(".spt_upload_files");

	    var onchange = function (evt) {
                var files = spt.html5upload.get_files();
                for (var i = 0; i < files.length; i++) {
                    spt.drag.show_file(files[i], files_el, 0, true);
                }
	    }

            spt.html5upload.set_form( top );
            spt.html5upload.select_file( onchange );

         '''
         } )



        button = ActionButtonWdg(title="Clear")
        button.add_style("float: right")
        button.add_style("margin-top: -3px")
        div.add(button)
        button.add_behavior( {
            'type': 'click_up',
#.........这里部分代码省略.........
开发者ID:funic,项目名称:TACTIC,代码行数:101,代码来源:ingest_wdg.py


示例19: get_display

    def get_display(my):

        top = my.top
        top.add_class("spt_db_config_top")
        top.add_style("width: 430px")
        top.add_style("min-height: 500")
        top.add_style("padding: 15px")
        top.add_style("margin-left: auto")
        top.add_style("margin-right: auto")
        top.add_color("background", "background", -10)
        top.add_border()

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("System Configuration Setup")
        title_wdg.add_style("font-size: 20px")


        top.add("<hr/>")

        top.add("<i style='opacity: 0.5'>%s</i><br/>" % Config.get_config_path())
        top.add("<br/>")


        checkin_keys=Config.get_section_values('checkin')
        checkin_keys=checkin_keys.keys()
        save_button = my.get_save_button(checkin_keys)
        top.add(save_button)
        vendor = Config.get_value("database", "vendor")

        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("<b>Database Setup</b>")
        title_wdg.add_style("margin-bottom: 10px")


        db_select = SelectWdg("database/vendor")
        db_select.set_option("labels", "SQLite|PostgreSQL|MySQL|Oracle|SQLServer")
        db_select.set_option("values", "Sqlite|PostgreSQL|MySQL|Oracle|SQLServer")

        db_select.set_value(vendor)



        db_select.add_behavior( {
        'type': 'change',
        'cbjs_action': '''

        var key;
        if (bvr.src_el.value == 'Sqlite') {
            key = 'Sqlite';
        }
        else {
            key = 'Other';
        }

        var top = bvr.src_el.getParent(".spt_db_config_top");
        var options_els = top.getElements(".spt_db_options");
        for (var i = 0; i < options_els.length; i++) {
            var vendor = options_els[i].getAttribute("spt_vendor");
            if (vendor == key) {
                spt.show(options_els[i]);
            }
            else {
                spt.hide(options_els[i]);
            }

        }
        '''
        } )
 
        option_div = DivWdg()
        top.add(option_div)
        option_div.add("Vendor: ")
        option_div.add(db_select)
        option_div.add_style("margin: 20px")

        sqlite_wdg = my.get_sqlite_wdg()
        option_div.add(sqlite_wdg)
        otherdb_wdg = my.get_otherdb_wdg()
        option_div.add(otherdb_wdg)

        if vendor == 'Sqlite':
            otherdb_wdg.add_style("display: none")
            sqlite_wdg.add_style("display", "")
        else:
            otherdb_wdg.add_style("display", "")
            sqlite_wdg.add_style("display: none")


        test_button = ActionButtonWdg(title="<< Test >>", tip="Test connecting to database")
        option_div.add(test_button)
        test_button.add_style("margin-left: auto")
        test_button.add_style("margin-right: auto")
        test_button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        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.DbConfigCbk';
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:101,代码来源:db_config_wdg.py


示例20: get_display

    def get_display(my):
        top = my.top

        view = my.kwargs.get("view")
        top.add_class("spt_help_edit_content")


        search = Search("config/widget_config")
        search.add_filter("category", "HelpWdg")
        search.add_filter("view", view)
        sobject = search.get_sobject()

        if not sobject:
            value = ""
            search_key = ""

        else:
            xml_value = sobject.get_xml_value("config")
            value = xml_value.get_value("config/%s/html/div" % (view) )
            search_key = sobject.get_search_key()


        title_wdg = DivWdg()
        top.add(title_wdg)
        title_wdg.add("<b>View: %s</b>" % view)
        title_wdg.add_style("font-style: bold")
        title_wdg.add_style("padding: 5px")
        title_wdg.add_gradient("background", "background", 0, -10)


        hidden = HiddenWdg("view")
        top.add(hidden)
        hidden.set_value(view)


        text = TextAreaWdg("content")
        text_id = text.set_unique_id()
        text.set_value(value)

        from tactic.ui.widget import ActionButtonWdg
        if sobject:
            delete_button = ActionButtonWdg(title="Delete")
            top.add(delete_button)
            delete_button.add_style("float: right")
            delete_button.add_style("margin-top: -3px")
            delete_button.add_behavior( {
            'type': 'click_up',
            'search_key': search_key,
            'cbjs_action': '''
            if (!confirm("Are you sure you wish to delete this help page?")) {
                return;
            }
            var server = TacticServerStub.get();
            server.delete_sobject(bvr.search_key);
            var top = bvr.src_el.getParent(".spt_help_edit_top");
            spt.panel.refresh(top);
            '''
            })



        test_button = ActionButtonWdg(title="Preview")
        top.add(test_button)
        test_button.add_style("float: right")
        test_button.add_style("margin-top: -3px")
        test_button.add_behavior( {
        'type': 'click_up',
        'text_id': text_id,
        'cbjs_action': '''

        var js_file = "ckeditor/ckeditor.js";

        var url = "/context/spt_js/" + js_file;
        var js_el = document.createElement("script");
        js_el.setAttribute("type", "text/javascript");
        js_el.setAttribute("src", url);

        var head = document.getElementsByTagName("head")[0];
        head.appendChild(js_el);



        var cmd = "CKEDITOR.instances." + bvr.text_id + ".getData()";
        var text_value = eval( cmd );

        bvr.options = {};
        bvr.options.html = text_value;
        spt.named_events.fire_event("show_help", bvr)
        '''
        })



        save_button = ActionButtonWdg(title="Save")
        top.add(save_button)
        save_button.add_style("float: right")
        save_button.add_style("margin-top: -3px")

        top.add("<br/>")

#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:101,代码来源:help_wdg.py



注:本文中的tactic.ui.widget.ActionButtonWdg类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python widget.IconButtonWdg类代码示例发布时间:2022-05-27
下一篇:
Python panel.HashPanelWdg类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap