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


Python HtmlElement.get_json_string方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.web import HtmlElement [as 别名]
# 或者: from pyasm.web.HtmlElement import get_json_string [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


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