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


Python SelectWdg.get_buffer_display方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import get_buffer_display [as 别名]
    def get_display(my):
        if not my.is_preprocess:
            my.preprocess()

        widget = DivWdg()
        widget.add_class('spt_input_top')

        # add a callback to determine the input key
        widget.add_attr('spt_cbjs_get_input_key', "return spt.dg_table.get_status_key(cell_to_edit, edit_cell)")

        # add a data structure mapping, processes to task pipelines
        #data = {
        #    "model": "task_model",
        #    "texture": "task_texture",
        #    "rig":  "task_rig"
        #}
       
        if my.task_mapping:
            json_str = HtmlElement.get_json_string(my.task_mapping)
            widget.add_attr('spt_task_pipeline_mapping', json_str)

        for pipeline in my.task_pipelines:
            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")

            div.add_attr("spt_input_key", pipeline.get_code())
         
            # if there is not task_pipeline_code, create a virtual one:
            if not pipeline:
                process_names = ['Pending', 'In Progress', 'Approved']
            else:
                process_names = pipeline.get_process_names()


            allowed_processes = []
            security = Environment.get_security()
            cur_value = ''
            cur_sobject = my.get_current_sobject()
            if cur_sobject:
                cur_value = cur_sobject.get_value('status')

            for process in process_names:
                # not all statuses can be shown, if there are access rules
                # TODO: remove this process_select in 4.1
                if cur_value == process or security.check_access("process_select", process, access='view', default='deny'):
                    allowed_processes.append(process)
                    continue

                # use the new access rule process here
                access_key = [
                    {'process': '*' ,'pipeline':  pipeline.get_code()},
                    {'process': '*' ,'pipeline':  '*'},
                    {'process': process , 'pipeline':  pipeline.get_code()}
                    ]


                if security.check_access('process', access_key, "view", default="deny"):
                    allowed_processes.append(process)
                

            select = SelectWdg(my.get_input_name())
            select.add_empty_option('-- Select --')
            if cur_value in allowed_processes:
                select.set_value( cur_value )
            select.set_option("values", allowed_processes)
            # only old table layout has behaviors at the widget level
            if my.behaviors:
                from tactic.ui.panel import CellEditWdg
                CellEditWdg.add_edit_behavior(select)

            div.add(select.get_buffer_display())
        
        return widget
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:76,代码来源:misc_input_wdg.py

示例2: get_first_row_wdg

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import get_buffer_display [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.SelectWdg.get_buffer_display方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。