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


Python DivWdg.replace方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import replace [as 别名]
    def get_display(self):

        top = DivWdg()
        top.add_border()
        top.add_style("padding: 10px")
        top.add_color("color", "color")
        top.add_color("background", "background")

        top.add_class("spt_reports_top")


        title = DivWdg()
        title.add("Themes")
        title.add_style("font-size: 18px")
        title.add_style("font-weight: bold")
        title.add_style("text-align: center")
        title.add_style("padding: 10px")
        title.add_style("margin: -10px -10px 10px -10px")
        title.add_gradient("background", "background3", 5, -10)
        top.add(title)

        from tactic.ui.widget import TitleWdg
        subtitle = TitleWdg(name_of_title='List of Themes',help_alias='project-startup-themes')
        top.add(subtitle)

        top.add("<br/>")

        themes = []

        # read the config file
        """
        from pyasm.widget import WidgetConfig
        tmp_path = __file__
        dir_name = os.path.dirname(tmp_path)
        file_path="%s/../config/themes-conf.xml" % (dir_name)
        config = WidgetConfig.get(file_path=file_path, view="definition")
        element_names = config.get_element_names()

        
        for element_name in element_names:
            attrs = config.get_element_attributes(element_name)
            theme_data = {}
            kwargs = config.get_display_options(element_name)
            class_name = kwargs.get('class_name')

            theme_data['class_name'] = class_name
            theme_data['kwargs'] = kwargs
            theme_data['title'] = attrs.get("title")
            theme_data['description'] = attrs.get("description")
            theme_data['image'] = attrs.get("image")

            themes.append(theme_data)
        """



        # get all of the configs from the database
        search = Search("config/widget_config")
        search.add_filter("widget_type", "theme")
        db_configs = search.get_sobjects()

        for db_config in db_configs:
            theme_data = {}
            view = db_config.get_value("view")
            kwargs = {
                'view': view
            }
            #parts = view.split(".")
            #title = Common.get_display_title(parts[-1])
            title = view
            title = title.replace(".", " ")
            title = title.replace("_", " ")
            title = Common.get_display_title(title)

            xml = db_config.get_value("config")

            theme_data['class_name'] = "tactic.ui.panel.CustomLayoutWdg"
            theme_data['kwargs'] = kwargs
            theme_data['view'] = view
            theme_data['title'] = title
            theme_data['description'] = title
            theme_data['image'] = None
            theme_data['xml'] = xml
            theme_data['widget_type'] = db_config.get_value("widget_type")

            themes.append(theme_data)




        if not themes:
            no_themes_div = DivWdg()
            top.add(no_themes_div)
            no_themes_div.add_style("margin-left: auto")
            no_themes_div.add_style("margin-right: auto")
            no_themes_div.add_style("width: 400px")
            no_themes_div.add_style("height: 50px")
            no_themes_div.add_style("text-align: center")
            no_themes_div.add_style("padding: 50px 50px")
            no_themes_div.add_style("margin-top: 100px")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:themes_wdg.py


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