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


Python TextInputWdg.add_behavior方法代码示例

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


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

示例1: get_timecode_textbox

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_behavior [as 别名]
    def get_timecode_textbox(self, name, width=200, line_data=None):
        timecode_textbox = TextInputWdg()
        timecode_textbox.set_id(name)
        timecode_textbox.set_name(name)
        timecode_textbox.add_style('width', '{0}px'.format(width))

        timecode_textbox.add_behavior(get_add_colons_for_time_behavior())

        if line_data:
            timecode_textbox.set_value(line_data)

        return timecode_textbox
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:14,代码来源:prequal_eval_lines_wdg.py

示例2: get_text_input_wdg

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_behavior [as 别名]
def get_text_input_wdg(name, data, width=200, timecode=False):
    textbox_wdg = TextInputWdg()
    textbox_wdg.set_id(name)
    textbox_wdg.set_name(name)
    textbox_wdg.add_style('width', '{0}px'.format(width))

    if timecode:
        textbox_wdg.add_behavior(get_add_colons_for_time_behavior())

    if data:
        textbox_wdg.set_value(data)

    return textbox_wdg
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:15,代码来源:utils.py

示例3: get_display

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

示例4: get_display

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

示例5: get_base_dir_wdg

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

示例6: get_display

# 需要导入模块: from tactic.ui.input import TextInputWdg [as 别名]
# 或者: from tactic.ui.input.TextInputWdg import add_behavior [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")
        td = table.add_cell(text)
        td.add_style("vertical-align: top")
        text.set_value("1666")


        table.add_row()
        td = table.add_cell("Login: ")
        td.add_style("vertical-align: top")
        td.add_style("width: 75px")

        text = TextInputWdg(name="user")
        td = table.add_cell(text)
        td.add_style("vertical-align: top")
        user = Environment.get_user_name()
        text.set_value(user)

        table.add_row()

        td = table.add_cell("Password: ")
        td.add_style("vertical-align: top")

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

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

        tr = table.add_row()
        td = table.add_cell("Workspace: ")
        td.add_style("vertical-align: top")
        text = TextInputWdg(name="workspace")
        td = table.add_cell(text)
        text.add_class("spt_workspace")


        text.add_behavior( {
            'type': 'load',
            '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];

            // 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) {
                    var workspace = workspaces[0];
                    var Root = workspace.root;
                    // TODO: make sure Root == snapshot_dir

                    console.log("workspace");
                    console.log(workspace);

                    var client = workspace.client;
                    var workspace_el = top.getElement(".spt_workspace");
                    workspace_el.value = client;
                }
                return;
            }
            ''' } )




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

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


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