本文整理汇总了Python中pyasm.widget.WidgetConfigView.get_element_node方法的典型用法代码示例。如果您正苦于以下问题:Python WidgetConfigView.get_element_node方法的具体用法?Python WidgetConfigView.get_element_node怎么用?Python WidgetConfigView.get_element_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.widget.WidgetConfigView
的用法示例。
在下文中一共展示了WidgetConfigView.get_element_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ManageSearchTypeDetailWdg
# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_element_node [as 别名]
class ManageSearchTypeDetailWdg(ManageSideBarDetailWdg):
ADD_COLUMN = "Commit New Column"
MODIFY_COLUMN = "Modify Column"
REMOVE_COLUMN = "Remove Column"
def get_config(self, search_type, view, default=False, personal=False):
config = ManageSearchTypeMenuWdg.get_config(search_type, view, default=default)
return config
def init(self):
'''initialize the widget_config, and from there retrieve the schema_config'''
web = WebContainer.get_web()
self.search_type = self.kwargs.get('search_type')
element_name = self.kwargs.get('element_name')
self.view = self.kwargs.get('view')
# FIXME: comment out the assert for now to avoid error screen
if not self.view:
self.view = 'table'
#assert self.view
self.config_xml = self.kwargs.get('config_xml')
if not self.config_xml:
self.config_xml = web.get_form_value('config_xml')
self.default = self.kwargs.get('default') == 'True'
cbk = ManageSearchTypeDetailCbk(search_type=self.search_type, view=self.view, \
element_name=element_name)
Command.execute_cmd(cbk)
self.config_string = ""
self.data_type_string = ""
self.name_string = ""
self.title_string = ""
self.nullable_string = ""
self.has_column = True
if element_name:
if self.config_xml:
self.config_string = self.config_xml
whole_config_string = "<config><%s>%s</%s></config>"%(self.view, self.config_xml, self.view)
config = WidgetConfig.get(xml=whole_config_string, view=self.view)
self.config = WidgetConfigView(self.search_type, self.view, [config])
else:
# don't pass in default here
self.config = self.get_config(self.search_type, self.view)
node = self.config.get_element_node(element_name)
if node is not None:
config_xml = self.config.get_xml()
self.config_string = config_xml.to_string(node)
self.title_string = config_xml.get_attribute(node, 'title')
schema_config = SearchType.get_schema_config(self.search_type)
attributes = schema_config.get_element_attributes(element_name)
self.data_type_string = attributes.get("data_type")
# double_precision is float
if self.data_type_string == 'double precision':
self.data_type_string = 'float'
self.name_string = attributes.get("name")
self.nullable_string = attributes.get("nullable")
self.is_new_column = attributes.get("new") == 'True'
# a database columnless widget
if not self.name_string:
self.has_column = False
def get_display(self):
# add the detail widget
detail_wdg = DivWdg(css='spt_detail_panel')
if not self.name_string and not self.config_string:
detail_wdg.add("<br/>"*3)
detail_wdg.add('<- Click on an item on the left for modification.')
detail_wdg.add_style("padding: 10px")
detail_wdg.add_color("background", "background", -5)
detail_wdg.add_style("width: 350px")
detail_wdg.add_style("height: 400px")
detail_wdg.add_border()
return detail_wdg
if self.kwargs.get("mode") == "empty":
overlay = DivWdg()
detail_wdg.add(overlay)
detail_wdg.add_border()
detail_wdg.add_color("color", "black")
detail_wdg.add_style("padding: 10px")
detail_wdg.add_color("background", "background", -5)
#.........这里部分代码省略.........