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


Python WidgetConfigView.get_xml方法代码示例

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


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

示例1: ManageSearchTypeDetailWdg

# 需要导入模块: from pyasm.widget import WidgetConfigView [as 别名]
# 或者: from pyasm.widget.WidgetConfigView import get_xml [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)

#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:search_type_manager_wdg.py


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