本文整理汇总了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