本文整理汇总了Python中pyasm.web.Widget.set_sobjects方法的典型用法代码示例。如果您正苦于以下问题:Python Widget.set_sobjects方法的具体用法?Python Widget.set_sobjects怎么用?Python Widget.set_sobjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.web.Widget
的用法示例。
在下文中一共展示了Widget.set_sobjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_display
# 需要导入模块: from pyasm.web import Widget [as 别名]
# 或者: from pyasm.web.Widget import set_sobjects [as 别名]
def get_display(my):
#parent_class = "TabWdg"
my.parent_class = my.parent_wdg.__class__.__name__
if my.parent_class == "TbodyWdg":
my.parent_class = "TableWdg"
elif my.parent_class == "MayaTabWdgImpl":
my.parent_class = "TabWdg"
# get the key
if my.parent_class == "TabWdg":
key = my.parent_wdg.get_tab_path()
elif my.parent_class == "TableWdg":
key = "%s|%s" % (my.search_type, my.parent_wdg.get_view() )
else:
key = my.parent_wdg.get_name()
# set sobjects from the parent, if there are any
my.sobjects = my.parent_wdg.get_sobjects()
# search for these
from pyasm.search import Search
search = Search("sthpw/widget_extend")
search.add_project_filter()
search.add_filter("type", my.parent_class)
search.add_filter("key", key)
extends = search.get_sobjects()
for extend in extends:
xml = extend.get_xml_value("data")
index = xml.get_value("widget/@index")
if index:
index = int(index)
else:
index = None
title = xml.get_value("widget/@name")
nodes = xml.get_nodes("widget/widget")
if nodes:
widget = Widget()
for node in nodes:
node_string = Xml.get_node_xml(node)
child_widget = CustomXmlWdg(node_string)
if not child_widget:
continue
if my.sobjects:
child_widget.set_sobjects(my.sobjects)
widget.add(child_widget)
else:
widget = CustomXmlWdg(xml.to_string())
if my.sobjects:
widget.set_sobjects(my.sobjects)
if my.parent_class == 'TableWdg':
table_element = widget.get_display_widget()
table_element.set_parent_wdg(my.parent_wdg)
my.parent_wdg.add(widget, title, index=index)