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


Python Search.set_value方法代码示例

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


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

示例1: create_theme

# 需要导入模块: from pyasm.search import Search [as 别名]
# 或者: from pyasm.search.Search import set_value [as 别名]
    def create_theme(my, theme):

        # get a built-in plugin
        plugin_base_dir = Environment.get_plugin_dir()
        zip_path = "%s/%s.zip" % (plugin_base_dir, theme)
        manifest_path = "%s/%s/manifest.xml" % (plugin_base_dir, theme)

        plugin_base_dir2 = Environment.get_builtin_plugin_dir()
        zip_path2 = "%s/%s.zip" % (plugin_base_dir2, theme)
        manifest_path2 = "%s/%s/manifest.xml" % (plugin_base_dir2, theme)

        # install the theme
        from tactic.command import PluginInstaller

        if os.path.exists(manifest_path):
            plugin_dir = "%s/%s" % (plugin_base_dir, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(zip_path):
            installer = PluginInstaller(zip_path=zip_path, register=True)
            installer.execute()
            is_builtin = False
        elif os.path.exists(manifest_path2):
            plugin_dir = "%s/%s" % (plugin_base_dir2, theme)
            installer = PluginInstaller(plugin_dir=plugin_dir, register=True)
            installer.execute()
            is_builtin = True
        elif os.path.exists(zip_path2):
            installer = PluginInstaller(zip_path=zip_path2, register=True)
            installer.execute()
            is_builtin = True
        else:
            raise Exception("Installation error: cannot find %s theme" % theme)

        from pyasm.biz import PluginUtil

        if is_builtin:
            plugin_util = PluginUtil(base_dir=plugin_base_dir2)
        else:
            plugin_util = PluginUtil()
        data = plugin_util.get_plugin_data(theme)

        # if the theme does not have the url defined (which it likely
        # shouldn't, but just in case ...
        search = Search("config/url")
        search.add_filter("url", "/index")
        url = search.get_sobject()
        if not url:

            index_view = data.get("index_view")
            if not index_view:
                # don't use the folder in the theme
                base = os.path.basename(theme)
                index_view = "%s/index" % base

            # set this as the default index
            search = SearchType.create("config/url")
            search.set_value("url", "/index")
            search.set_value(
                "widget",
                """
<element name='index'>
  <display class='tactic.ui.panel.CustomLayoutWdg'>
    <view>%s</view>
  </display>
</element>
            """
                % index_view,
            )
            search.set_value("description", "Index Page")
            search.commit()
开发者ID:pombredanne,项目名称:TACTIC,代码行数:74,代码来源:create_project_cmd.py


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