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


Python TextWdg.set_persist_on_submit方法代码示例

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


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

示例1: get_config_wdg

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_persist_on_submit [as 别名]
    def get_config_wdg(my):
        widget = Widget()

        search = Search("sthpw/widget_config")

        div = DivWdg(css="filter_box")

        span = SpanWdg(css="med")
        span.add("Search Type: ")

        select = FilterSelectWdg("config_search_type")
        select.add_empty_option("-- Select --")
        search_type_search = Search("sthpw/search_object")
        search_type_search.add_order_by("search_type")
        span.add(select)
        project = Project.get()
        project_type = project.get_base_type()
        filter = search.get_regex_filter("search_type", "login|task|note|timecard", "EQ")
        search_type_search.add_where(
            """
        namespace = '%s' or namespace = '%s' or %s
        """
            % (project_type, project.get_code(), filter)
        )
        select.set_search_for_options(search_type_search, value_column="search_type")
        div.add(span)

        search_type_value = select.get_value()

        span = SpanWdg()
        view_text = TextWdg("view")
        view_text.set_persist_on_submit()
        span.add("View: ")
        span.add(view_text)
        div.add(span)
        widget.add(div)
        view = view_text.get_value()
        if view:
            search.add_filter("view", view)
        if search_type_value:
            search.add_filter("search_type", search_type_value)

        table = TableWdg("sthpw/widget_config")
        table.set_search(search)

        widget.add(table)

        return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:50,代码来源:custom_project_tab_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_persist_on_submit [as 别名]
    def get_display(self):
        type = self.kwargs.get("type")

        if type not in ['string', 'varchar', 'float', 'integer', 'timestamp', 'login']:
            print("WARNING: FilterWdg: type [%s] not supported, using 'string'" % type)
            type = 'string'

        filter_span = SpanWdg()

        web = WebContainer.get_web()

        if type in ["string", "varchar"]:

            relations = ["is", "is not", "contains", "does not contain", "is empty", "starts with", "ends with"]
            relation_select = SelectWdg("%s_relation" % self.prefix)
            relation_select.set_option("values", relations)
            relation_select.set_persist_on_submit()
            self.set_filter_value(relation_select)

            filter_span.add(relation_select)
            value_text = TextWdg("%s_value" % self.prefix)
            value_text.set_persist_on_submit()
            self.set_filter_value(value_text)
            filter_span.add(value_text)

        elif type in ['integer', 'float', 'currency']:
            relations = ["is equal to", "is greater than", "is less than"]
            relation_select = SelectWdg("%s_relation" % self.prefix)
            relation_select.set_option("values", relations)
            relation_select.set_persist_on_submit()
            self.set_filter_value(relation_select)
            filter_span.add(relation_select)

            value_text = TextWdg("%s_value" % self.prefix)
            value_text.set_persist_on_submit()
            self.set_filter_value(value_text)
            filter_span.add(value_text)

        elif type == 'timestamp':
            relations = ["is newer than", "is older than"]
            relation_select = SelectWdg("%s_relation" % self.prefix)
            relation_select.set_option("values", relations)
            relation_select.set_persist_on_submit()
            self.set_filter_value(relation_select)
            filter_span.add(relation_select)

            options = ["1 day", '2 days', '1 week', '1 month']
            another_select = SelectWdg("%s_select" % self.prefix)
            another_select.add_empty_option("-- Select --")
            another_select.set_option("values", options)
            another_select.set_persist_on_submit()
            self.set_filter_value(another_select)
            filter_span.add(another_select)

            filter_span.add(" or ")

            value_text = TextWdg("%s_value" % self.prefix)
            value_text.set_persist_on_submit()
            self.set_filter_value(value_text)
            filter_span.add(value_text)

        elif type in ['login']:

            relations = ["is", "is not", "contains", "does not contain", "is empty", "starts with", "ends with"]
            relation_select = SelectWdg("%s_relation" % self.prefix)
            relation_select.set_option("values", relations)
            relation_select.set_persist_on_submit()
            self.set_filter_value(relation_select)
            filter_span.add(relation_select)

            value_text = CheckboxWdg("%s_user" % self.prefix)
            value_text.set_persist_on_submit()
            self.set_filter_value(value_text)
            filter_span.add(value_text)
            filter_span.add("{user}")

            filter_span.add(" or ")

            value_text = TextWdg("%s_value" % self.prefix)
            value_text.set_persist_on_submit()
            self.set_filter_value(value_text)
            filter_span.add(value_text)


        return filter_span
开发者ID:mincau,项目名称:TACTIC,代码行数:87,代码来源:type_filter_element_wdg.py

示例3: get_first_row_wdg

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_persist_on_submit [as 别名]

#.........这里部分代码省略.........
        data_row = data_row_text.get_value()
        if not data_row:
            data_row = 0
        else:
            try:
                data_row = int(data_row)
            except ValueError:
                data_row = 0

            if data_row >= len(csv_data):
                data_row = len(csv_data)-1
        data_row_text.set_value(data_row)




        table = Table()
        table.set_attr("cellpadding", "10")

        table.add_row()
        table.add_header("CSV Column Value")
        table.add_header("TACTIC Column")
        table.add_header("Create New Column")
        
        columns = my.search_type_obj.get_columns()
        search_type = my.search_type_obj.get_base_search_type()
        sobj = SObjectFactory.create(search_type)
        required_columns = sobj.get_required_columns()
        
        row = csv_data[data_row]
        labels = []
        for column in columns:
            if column in required_columns:
                label = '%s**'%column
            else:
                label = column
            labels.append(label)

        for j, cell in enumerate(row):
            table.add_row()
            table.add_cell(cell)

            column_select = SelectWdg("column_%s" % j)
            column_select.add_event("onchange", "if (this.value!='') {set_display_off('new_column_div_%s')} else {set_display_on('new_column_div_%s')}" % (j,j))

            column_select.add_empty_option("-- Select --")
            column_select.set_option("values", columns)
            column_select.set_option("labels", labels)

            # only set the value if it is actually in there
            if csv_titles[j] in columns:
                column_select.set_option("default", csv_titles[j])
            column_select.set_persist_on_submit()
            column_select_value = column_select.get_value()


            display = column_select.get_buffer_display()
            td = table.add_cell( display )

            if csv_titles[j] not in columns:
                td.add(" <b style='color: red'>*</b>")

                # new property
                new_column_div = DivWdg()

                if column_select_value:
                    new_column_div.add_style("display", "none")
                else:
                    new_column_div.add_style("display", "block")

                new_column_div.set_id("new_column_div_%s" % j)

                td = table.add_cell( new_column_div )
                text = TextWdg("new_column_%s" % j)
                text.set_persist_on_submit()

                if my.has_title:
                    text.set_value(csv_titles[j])


                new_column_div.add( " ... or ..." )
                new_column_div.add( text )


        my.num_columns = len(row)
        hidden = HiddenWdg("num_columns", my.num_columns)


        # need to somehow specify defaults for columns


        div.add(table)

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


        div.add(my.get_preview_wdg())


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


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