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


Python TextInputWdg.add_class方法代码示例

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


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

示例1: get_add_chat_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    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,代码行数:47,代码来源:message_wdg.py

示例2: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg 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_nav_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_nav_wdg(self):

        #base_dir = self.kwargs.get("base_dir")
        #location = self.kwargs.get("location")
        base_dir = self.session.get_value("base_dir")
        location = self.session.get_value("location")

        nav_wdg = DivWdg()

        nav_wdg.add("<b>Session 101 - Clean up self Crap</b><hr/>")
    

        nav_wdg.add_style("margin-bottom: 10px")
        nav_wdg.add_class("spt_file_nav")
        nav_wdg.add_style("width: 575px")
        nav_wdg.add_border()
        nav_wdg.set_round_corners()
        nav_wdg.add_style("padding: 5px")

        button = ActionButtonWdg(title="Scan", tip="Scan for files in specified folder")
        button.add_style("float: right")
        button.add_style("margin-top: -5px")
        nav_wdg.add(button)


        from tactic.ui.input import TextInputWdg
        title_wdg = "Session Title: "
        nav_wdg.add(title_wdg)
        text = TextInputWdg(name="title")
        text.add_class("spt_title")
        text.add_style("width: 300px")
        nav_wdg.add(text)

        nav_wdg.add("<br/><br/>")


        folder_wdg = "Base folder of this session: "
        nav_wdg.add(folder_wdg)

        text = TextInputWdg(name="base_dir")
        text.add_class("spt_base_dir")
        text.add_style("width: 300px")
        if base_dir:
            text.set_value(base_dir)
        nav_wdg.add(text)

        # add a hidden paths variable
        text = HiddenWdg("paths")
        text.add_class("spt_paths")
        nav_wdg.add(text)

        nav_wdg.add("<br/>")

        # add a hidden paths variable
        select = SelectWdg("location")
        if location:
            select.set_value(location)
        nav_wdg.add("<br/>")
        nav_wdg.add("Folder is on ")
        nav_wdg.add(select)
        select.set_option("values", "local|server")

        
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''

        var top = bvr.src_el.getParent(".spt_ingestion_top");
        var nav = top.getElement(".spt_file_nav");

        var nav_values = spt.api.Utility.get_input_values(nav,null,false);

        var base_dir = nav_values.base_dir;
        var location = nav_values.location;

        spt.app_busy.show("Scanning", base_dir);

        if (location == 'local') {
            var applet = spt.Applet.get();
            var paths = applet.list_dir(base_dir, 2);
            var paths_el = nav.getElement(".spt_paths");
            var js_paths = [];
            for (var i = 0; i < paths.length; i++) {
                var js_path = paths[i].replace(/\\\\/g,"/");
                if (applet.is_dir(js_path) ) {
                    js_path = js_path + '/';
                    js_paths.push(js_path);
                }
                //if (i > 100) break;
                else {
                    js_paths.push(js_path);
                }
            }

            paths_el.value = js_paths.join("|");

        }

        //var nav_values = spt.api.Utility.get_input_values(nav,null,false);
        //spt.panel.refresh(top, nav_values);
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:ingestion_wdg.py

示例4: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_display(my):
        top = my.top
        top.add_class("spt_script_editor_top")

        """
        top.add_class("SPT_CHANGE")
        top.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            register_change = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                change_top.addClass("SPT_HAS_CHANGES");
                change_top.update_change(change_top, bvr);
            }

            has_changes = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                return change_top.hasClass("SPT_HAS_CHANGES");
            }

            bvr.src_el.update_change = function(top, bvr) {
                change_el = top.getElement(".spt_change_element");
                change_el.setStyle("display", "");
            }
            '''
        } )
        """

        change_div = DivWdg()
        top.add(change_div)
        #change_div.add("CHANGES!!!")
        change_div.add_style("display: none")
        change_div.add_class("spt_change_element");





        top.add_class("spt_panel")
        top.add_class("spt_js_editor")
        top.add_attr("spt_class_name", Common.get_full_class_name(my) )
        top.add_color("background", "background")
        top.add_style("padding", "10px")
       


        div = DivWdg()
        top.add(div)


        # if script_path
        script_path = my.kwargs.get("script_path")
        search_key = my.kwargs.get("search_key")
        if script_path:
            search = Search("config/custom_script")
            dirname = os.path.dirname(script_path)
            basename = os.path.basename(script_path)

            search.add_filter("folder", dirname)
            search.add_filter("title", basename)
            script_sobj = search.get_sobject()
        elif search_key:
            script_sobj = Search.get_by_search_key(search_key)
        else:
            script_sobj = None


        if script_sobj:
            script_code = script_sobj.get_value("code")
            script_folder = script_sobj.get_value("folder")
            script_name = script_sobj.get_value("title")
            script_value = script_sobj.get_value("script")
            script_language = script_sobj.get_value("langauge")
        else:
            script_code = ''
            script_folder = ''
            script_name = ''
            script_value = ''




        editor = AceEditorWdg(custom_script=script_sobj)
        my.editor_id = editor.get_editor_id()


        if not Container.get_dict("JSLibraries", "spt_script_editor"):
            div.add_behavior( {
                'type': 'load',
                'cbjs_action': my.get_onload_js()
            } )


        # create the insert button
        help_button_wdg = DivWdg()
        div.add(help_button_wdg)
        help_button_wdg.add_style("float: right")
        help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
        help_button_wdg.add(help_button)

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

示例5: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_display(my):

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


        top.add_color("background", "background")
        top.add_style("padding: 30px")
        top.add_style("width: 300px")


        icon = IconWdg("Not signed in", IconWdg.WARNING)
        top.add(icon)

        top.add("You are not signed into Perforce.")
        top.add("<br/>"*2)


        table = Table()
        top.add(table)


        from tactic.ui.input import TextInputWdg, PasswordInputWdg

        table.add_row()
        td = table.add_cell("Port: ")
        td.add_style("width: 75px")

        text = TextInputWdg(name="port")
        table.add_cell(text)
        text.set_value("1666")

        tr = table.add_row()
        table.add_row_cell("&nbsp;")

        table.add_row()
        td = table.add_cell("Login: ")
        td.add_style("width: 75px")

        text = TextInputWdg(name="user")
        table.add_cell(text)
        user = Environment.get_user_name()
        text.set_value(user)

        table.add_row()

        table.add_cell("Password: ")

        text = PasswordInputWdg(name="password")
        table.add_cell(text)

        tr = table.add_row()
        table.add_row_cell("&nbsp;")

        tr = table.add_row()
        table.add_cell("Workspace: ")
        text = TextInputWdg(name="workspace")
        table.add_cell(text)
        text.add_class("spt_workspace")



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


        button = ActionButtonWdg(title="Sign In", icon=IconWdg.PUBLISH, size='medium')
        top.add(button)
        button.add_style("float: right")


        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_sign_in_top");
            var values = spt.api.get_input_values(top);

            var port = values.port[0];
            var user = values.user[0];
            var password = values.password[0];
            var client = values.workspace[0];

            // login in user
            spt.scm.port = port;
            spt.scm.user = user;
            spt.scm.password = password;
            spt.scm.client = client;


            // test the connection
            var ping = spt.scm.ping();
            if (ping != "OK") {
                spt.scm.show_login();
                return;
            }

            // TODO: get the workspaces and use this as a list
            // For now, just fill it in with the first one
            if (!client) {
                var workspaces = spt.scm.get_workspaces();
                if (workspaces.length > 0) {
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:scm_dir_list_wdg.py

示例6: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_display(my):
        top = my.top
        top.add_class("spt_script_editor_top")

        """
        top.add_class("SPT_CHANGE")
        top.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            register_change = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                change_top.addClass("SPT_HAS_CHANGES");
                change_top.update_change(change_top, bvr);
            }

            has_changes = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                return change_top.hasClass("SPT_HAS_CHANGES");
            }

            bvr.src_el.update_change = function(top, bvr) {
                change_el = top.getElement(".spt_change_element");
                change_el.setStyle("display", "");
            }
            '''
        } )
        """

        change_div = DivWdg()
        top.add(change_div)
        #change_div.add("CHANGES!!!")
        change_div.add_style("display: none")
        change_div.add_class("spt_change_element");





        top.add_class("spt_panel")
        top.add_class("spt_js_editor")
        top.add_attr("spt_class_name", Common.get_full_class_name(my) )
        top.add_color("background", "background")
        top.add_style("padding", "10px")
       


        div = DivWdg()
        top.add(div)


        # if script_path
        script_path = my.kwargs.get("script_path")
        search_key = my.kwargs.get("search_key")
        if script_path:
            search = Search("config/custom_script")
            dirname = os.path.dirname(script_path)
            basename = os.path.basename(script_path)

            search.add_filter("folder", dirname)
            search.add_filter("title", basename)
            script_sobj = search.get_sobject()
        elif search_key:
            script_sobj = Search.get_by_search_key(search_key)
        else:
            script_sobj = None


        if script_sobj:
            script_code = script_sobj.get_value("code")
            script_folder = script_sobj.get_value("folder")
            script_name = script_sobj.get_value("title")
            script_value = script_sobj.get_value("script")
            script_language = script_sobj.get_value("language")
        else:
            script_code = ''
            script_folder = ''
            script_name = ''
            script_value = ''




        editor = AceEditorWdg(custom_script=script_sobj)
        my.editor_id = editor.get_editor_id()


        if not Container.get_dict("JSLibraries", "spt_script_editor"):
            div.add_behavior( {
                'type': 'load',
                'cbjs_action': my.get_onload_js()
            } )


        # create the insert button
        help_button_wdg = DivWdg()
        div.add(help_button_wdg)
        help_button_wdg.add_style("float: right")
        help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
        help_button_wdg.add(help_button)

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

示例7: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_display(self):

        top = self.top
        top.add_color("background", "background")
        top.add_class("spt_pipelines_top")
        self.set_as_panel(top)

        inner = DivWdg()
        top.add(inner)


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

        if search_type:
            search = Search("sthpw/pipeline")
            search.add_filter("search_type", search_type)
            pipelines = search.get_sobjects()
        else:
            pipeline = Pipeline.get_by_code(pipeline_code)
            if pipeline:
                pipelines = [pipeline]
            else:
                pipelines = []


        if not pipelines:
            div = DivWdg()
            inner.add(div)
            inner.add_style("padding: 50px")
            div.add_border()
            div.add_color("color", "color3")
            div.add_color("background", "background3")
            div.add_style("width: 400px")
            div.add_style("height: 100px")
            div.add_style("padding: 30px")
           
            icon = IconWdg("WARNING", IconWdg.WARNING)
            div.add(icon)
            div.add("<b>This Searchable Type does not have pipelines defined.</b>")
            div.add("<br/>"*2)

            div.add("<b style='padding-left: 35px'>Click Create to add one...</b>")
            div.add("<br/>"*2)
 
            button_div = DivWdg()
            div.add(button_div)

            button = ActionButtonWdg(title="Create", tip="Create pipeline")
            button_div.add(button)
            button.add_style("margin: auto")
            button.add_behavior( {
                'type': 'click_up',
                'search_type': search_type,
                'cbjs_action': '''
                var server = TacticServerStub.get();

                var cmd = 'tactic.ui.startup.PipelineCreateCbk';
                var kwargs = {
                    search_type: bvr.search_type
                }
                server.execute_cmd(cmd, kwargs)

                var top = bvr.src_el.getParent(".spt_pipelines_top");
                spt.panel.refresh(top);
                '''
            } )

            return top



        # get the defalt task statuses
        task_pipeline = Pipeline.get_by_code("task")
        if task_pipeline:
            statuses = task_pipeline.get_process_names()
        else:
            statuses = ['Pending', 'In Progress', 'Complete']
        statuses_str = ",".join(statuses)



        pipelines_div = DivWdg()
        inner.add( pipelines_div )
        pipelines_div.add_style("font-size: 12px")
        pipelines_div.add_style("padding: 10px")

        buttons_div = DivWdg()
        pipelines_div.add(buttons_div)

        #button = SingleButtonWdg( title="Save Pipelines", icon=IconWdg.SAVE )
        button = ActionButtonWdg( title="Save" )
        buttons_div.add(button)
        button.add_behavior( {
        'type': 'click_up',
        'default_statuses': statuses_str,
        'cbjs_action': '''
        spt.app_busy.show("Saving Pipeline...")

        setTimeout(function() {
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:pipeline_edit_wdg.py

示例8: get_file_mode_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_file_mode_wdg(self):
        div = DivWdg()
        div.add_style("margin-top: 15px")
        div.add_style("margin-bottom: 15px")
        div.add_class("spt_file_mode")

        # drop folder
        div.add("A writable folder is required.  This is the folder that sync will drop the transacton file into.  This folder should be common to all shares that need to have recieve the transactions.")

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

        # only valid for standalone
        browser = WebContainer.get_web().get_browser()
        if browser == 'Qt':
            button = ActionButtonWdg(title="Browse")
            div.add(button)
            button.add_style("float: right")

            button.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                var applet = spt.Applet.get();
                var files = applet.open_file_browser();
                if (files.length == 0) {
                    return;
                }

                var dir = files[0];
                if (!applet.is_dir(dir)) {
                    spt.alert("Please select a folder");
                    return;
                }
                var top = bvr.src_el.getParent(".spt_file_mode");
                var folder_el = top.getElement(".spt_sync_folder");
                folder_el.value = dir;

                '''
            } )

        div.add("Sync Folder: ")
        text = TextInputWdg(name="sync_folder")
        text.add_class("spt_sync_folder")
        text.add_style("width: 300px")
        div.add(text)

        #div.add("<br/>"*2)
        #div.add("Set whether this transaction is plaintext, zipped or encrypted.")

        div.add("<br/>"*3)
        div.add("The transactions can be encrypted with an encryption ticket.  All shares must set this to be the same value in order for the transaction to be appropriately encrypted and decrypted.")


        div.add("<br/>"*2)
        div.add("Encrypt Transactions? ")
        checkbox = CheckboxWdg("is_encrypted")
        div.add(checkbox)
        checkbox.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_file_mode");
            var el = top.getElement(".spt_encrypt");
            if (el.getStyle("display") == "none") {
                el.setStyle("display", "");
            }
            else {
                el.setStyle("display", "none");
            }
            '''
        } )



        #div.add("Set whether this transaction is plaintext, zipped or encrypted.")
        encrypt_div = DivWdg()
        encrypt_div.add_class("spt_encrypt")
        div.add(encrypt_div)
        encrypt_div.add_style("display: none")
        encrypt_div.add_style("padding: 30px 20px 30px 20px")
        encrypt_div.add("Encryption Key: ")
        text = TextWdg("encrypt_key")
        text.add_style("width: 300px")
        encrypt_div.add(text)

        #div.add(self.get_ticket_wdg())


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

示例9: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_display(self):

        top = self.top
        top.add_color("background", "background")
        top.add_class("spt_columns_top")
        self.set_as_panel(top)
        top.add_style("padding: 10px")

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

        inner = DivWdg()
        top.add(inner)
        inner.add_style("width: 800px")

        #text = TextWdg("search_type")
        text = HiddenWdg("search_type")
        inner.add(text)
        text.set_value(search_type)

        title_wdg = DivWdg()
        inner.add(title_wdg)
        title_wdg.add( search_type_obj.get_title() )
        title_wdg.add(" <i style='font-size: 9px;opacity: 0.5'>(%s)</i>" % search_type)
        title_wdg.add_style("padding: 5px")
        title_wdg.add_color("background", "background3")
        title_wdg.add_color("color", "color3")
        title_wdg.add_style("margin: -10px -10px 10px -10px")
        title_wdg.add_style("font-weight: bold")





        shelf_wdg = DivWdg()
        inner.add(shelf_wdg)
        shelf_wdg.add_style("height: 35px")
        button = ActionButtonWdg(title='Create', color="default", icon="BS_SAVE")
        shelf_wdg.add(button)
        shelf_wdg.add_style("float: right")




        button.add_behavior( {
            'type': 'click_up',
            'search_type': search_type,
            'cbjs_action': '''
            var class_name = 'tactic.ui.startup.ColumnEditCbk';
            var top = bvr.src_el.getParent(".spt_columns_top");

            var elements = top.getElements(".spt_columns_element");

            var values = [];
            for (var i = 0; i < elements.length; i++ ) {
                var data = spt.api.Utility.get_input_values(elements[i], null, false);
                values.push(data)
            }

            var kwargs = {
                search_type: bvr.search_type,
                values: values
            }


            var server = TacticServerStub.get();
            try {
                server.execute_cmd(class_name, kwargs);

                var names = [];
                for (var i = 0; i < values.length; i++) {
                    var name = values[i].name;
                    name = name.strip();
                    if (name == '') { continue; }
                    names.push(name);
                }

                // Unless there is a table here, we should not do this.
                // Better handled with a callback
                //spt.table.add_columns(names)

                // prevent grabbing all values, pass in a dummy one
                spt.panel.refresh(top, {'refresh': true});

            } catch(e) {
                spt.alert(spt.exception.handler(e));
            }

            '''
        } )
        

        # add the headers
        table = Table()
        inner.add(table)
        table.add_style("width: 100%")
        tr = table.add_row()
        tr.add_color("background", "background", -5)
        th = table.add_header("Column Name")
        th.add_style("width: 190px")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:column_edit_wdg.py

示例10: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg 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

示例11: get_base_dir_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]
    def get_base_dir_wdg(self):

        div = DivWdg()

        title = DivWdg()
        div.add(title)
        title.add("Sync Project Import: ")
        title.add_style("font-size: 14px")
        title.add_style("font-weight: bold")

        div.add("<br/>")


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

        is_local = False

        if is_local:
            button = ActionButtonWdg(title="Browse")
            div.add(button)
            button.add_style("float: right")
            button.add_style("margin-top: -5px")
            button.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                var applet = spt.Applet.get();
                var files = applet.open_file_browser();
                if (!files.length) {
                    return;
                }

                var file = files[0];

                var top = bvr.src_el.getParent(".spt_sync_import_top");
                var el = top.getElement(".spt_sync_base_dir");
                el.value = file;

                '''
            } )



        div.add("Share Location: ")


        text = TextInputWdg(name="base_dir")
        div.add(text)
        text.add_class("spt_sync_base_dir")
        text.add_style("width: 300px")
        if base_dir:
            text.set_value(base_dir)


        text.add_behavior( {
            'type': 'blur',
            'is_local': is_local,
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_sync_import_top");
            var applet = spt.Applet.get();

            var value = bvr.src_el.value;
            var manifest_path = value + "/tactic.txt";


            if (!value) {
                return;
            }

            if (bvr.is_local) {

                if (!applet.exists(value)) {
                    alert('Share folder does not exist.');
                    return;
                }
                if (!applet.exists(manifest_path)) {
                    alert('Cannot find manifest file.');
                    return;
                }

                var data = applet.read_file(manifest_path);
                var json = JSON.parse(data);
                data = JSON.stringify(json);
                top.setAttribute("spt_data", data)
            }

            top.setAttribute("spt_base_dir", value)

            spt.panel.refresh(top);
            '''
        } )

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

示例12: get_upload_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_class [as 别名]

#.........这里部分代码省略.........
            else  {
              alert('Error: file object cannot be found.')
            }
            spt.app_busy.hide();'''%ticket
            from tactic.ui.input import UploadButtonWdg
            browse = UploadButtonWdg(name='new_csv_upload', title="Browse", tip="Click to choose a csv file",\
                    on_complete=on_complete, ticket=ticket)
            browse.add_style('float: left')
            msg.add(browse)


            
            # this is now only used in the copy and paste Upload button for backward-compatibility
            upload_wdg = SimpleUploadWdg(key=key, show_upload=False)
            upload_wdg.add_style('display: none')
            msg.add(upload_wdg)

            msg.add("<br/>")
          
            msg.add("<div style='margin: 30px; text-align: center'>-- OR --</div>")

            msg.add("<b>Published URL: </b><br/>") 
            from tactic.ui.input import TextInputWdg
            text = TextInputWdg(name="web_url")
            text.add_style("width: 100%")
            msg.add(text)
 


            msg.add("<div style='margin: 30px; text-align: center'>-- OR --</div>")

            msg.add("<b>Copy and Paste from a Spreadsheet: </b><br/>") 
            text = TextAreaWdg("data")
            text.add_style('width: 100%')
            text.add_style('height: 100px')
            text.add_class("spt_import_cut_paste")
            msg.add(text)
            msg.add("<br/>"*3)
            button = ActionButtonWdg(title="Parse")
            button.add_style("margin: 5px auto")
            msg.add(button)
            button.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                var top = bvr.src_el.getParent(".spt_import_top");
                var el = top.getElement(".spt_import_cut_paste");

                var value = el.value;
                var csv = [];
                // convert to a csv file!
                lines = value.split("\\n");
                for (var i = 0; i < lines.length; i++) {
                    if (lines[i] == '') {
                        continue;
                    }
                    var parts = lines[i].split("\\t");
                    var new_line = [];
                    for (var j = 0; j < parts.length; j++) {
                        if (parts[j] == '') {
                            new_line.push('');
                        }
                        else {
                            new_line.push('"'+parts[j]+'"');
                        }
                    }
                    new_line = new_line.join(",");
                    csv.push(new_line);
                }

                csv = csv.join("\\n")

                /*
                // FIXME: need to get a local temp directory
                var applet = spt.Applet.get();
                var path = spt.browser.os_is_Windows() ? "C:/sthpw/copy_n_paste.csv" : "/tmp/sthpw/copy_n_paste.csv";
                applet.create_file(path, csv);

                // upload the file
                applet.upload_file(path)
                applet.rmtree(path);

                var top = bvr.src_el.getParent(".spt_import_csv");
                var hidden = top.getElement(".spt_upload_hidden");
                hidden.value = path;

                var file_name = spt.path.get_basename(hidden.value);
                file_name = spt.path.get_filesystem_name(file_name); 
                */

                var class_name = 'tactic.ui.widget.CsvImportWdg';
                var values = spt.api.Utility.get_input_values('csv_import_main');
                values['is_refresh'] = true;
                //values['file_name'] = file_name;
                values['data'] = csv;
                var info = spt.panel.load('csv_import_main', class_name, {}, values);
                '''
            } )

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


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