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


Python Style.getDefaultStyle方法代码示例

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


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

示例1: testSelfDefault

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def testSelfDefault(self):
        style = Style()

        page = self.rootwiki[u"Викистраница 1"]
        style.setPageStyle(page, style.getPageStyle(page))

        self.assertEqual(os.path.abspath(style.getPageStyle(page)), os.path.abspath(style.getDefaultStyle()))
开发者ID:qyqx,项目名称:outwiker,代码行数:9,代码来源:styles.py

示例2: testDefault

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
 def testDefault(self):
     """
     Проверка того, что возвращается правильный путь до шаблона по умолчанию
     """
     style = Style()
     defaultStyle = style.getDefaultStyle()
     self.assertEqual(os.path.abspath(defaultStyle), os.path.abspath("styles/__default/__style.html"))
开发者ID:qyqx,项目名称:outwiker,代码行数:9,代码来源:styles.py

示例3: generateHtml

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def generateHtml (self, page):
        path = self.getHtmlPath (page)

        if page.readonly and os.path.exists (path):
            # Если страница открыта только для чтения и html-файл уже существует, то покажем его
            return path

        style = Style()
        stylepath = style.getPageStyle (page)

        try:
            tpl = HtmlTemplate (stylepath)
        except:
            MessageBox (_(u"Page style Error. Style by default is used"),  
                    _(u"Error"),
                    wx.ICON_ERROR | wx.OK)

            tpl = HtmlTemplate (style.getDefaultStyle())

        if page.autoLineWrap:
            text = HtmlImprover.run (page.content)
            text = re.sub ("\n<br>\n(<li>)|(<li>)", "\n<LI>", text)
        else:
            text = page.content

        result = tpl.substitute (content=text)

        with open (path, "wb") as fp:
            fp.write (result.encode ("utf-8"))

        return path
开发者ID:qyqx,项目名称:outwiker,代码行数:33,代码来源:htmlpageview.py

示例4: _makeHtml

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def _makeHtml(self, page):
        style = Style()
        stylepath = style.getPageStyle(page)

        try:
            tpl = HtmlTemplate(readTextFile(stylepath))
        except EnvironmentError:
            tpl = HtmlTemplate(readTextFile(style.getDefaultStyle()))

        content = self._changeContentByEvent(
            page,
            PreprocessingParams(page.content),
            self._application.onPreprocessing)

        if page.autoLineWrap:
            content = self._changeContentByEvent(
                page,
                PreHtmlImprovingParams(content),
                self._application.onPreHtmlImproving)

            config = HtmlRenderConfig(self._application.config)
            improverFactory = HtmlImproverFactory(self._application)
            text = improverFactory[config.HTMLImprover.value].run(content)
        else:
            text = content

        result = tpl.substitute(content=text,
                                title=page.display_title)

        result = self._changeContentByEvent(page,
                                            PostprocessingParams(result),
                                            self._application.onPostprocessing)
        return result
开发者ID:Jenyay,项目名称:outwiker,代码行数:35,代码来源:htmlpagecontroller.py

示例5: testFakeStyle

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def testFakeStyle(self):
        style = Style()
        page = self.rootwiki[u"Викистраница 1"]
        os.mkdir(os.path.join(page.path, self._styleFname))

        validStyle = os.path.abspath(style.getDefaultStyle())
        pageStyle = os.path.abspath(style.getPageStyle(page))

        self.assertEqual(pageStyle, validStyle)
开发者ID:qyqx,项目名称:outwiker,代码行数:11,代码来源:styles.py

示例6: testStylePageDefault

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def testStylePageDefault(self):
        """
        Проверка на то, что если у страницы нет файла стиля, то возвращается стиль по умолчанию
        """
        style = Style()
        defaultStyle = style.getDefaultStyle()
        style_page1 = style.getPageStyle(self.rootwiki[u"Викистраница 1"])
        style_page2 = style.getPageStyle(self.rootwiki[u"Html-страница 2"])

        self.assertEqual(style_page1, defaultStyle)
        self.assertEqual(style_page2, defaultStyle)
开发者ID:qyqx,项目名称:outwiker,代码行数:13,代码来源:styles.py

示例7: generateHtml

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def generateHtml (self, page):
        style = Style()
        stylepath = style.getPageStyle (page)
        generator = HtmlGenerator (page)

        try:
            html = generator.makeHtml(stylepath)
        except:
            MessageBox (_(u"Page style Error. Style by default is used"),  
                    _(u"Error"),
                    wx.ICON_ERROR | wx.OK)

            html = generator.makeHtml (style.getDefaultStyle())

        return html
开发者ID:s200999900,项目名称:outwiker,代码行数:17,代码来源:wikipanel.py

示例8: testSetStyle2

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def testSetStyle2(self):
        style = Style()
        page = self.rootwiki[u"Викистраница 1"]

        pageStyleFname = os.path.join(page.path, self._styleFname)
        pageStyleDir = os.path.join(page.path, self._styleDir)

        self.assertFalse(os.path.exists(pageStyleDir))
        self.assertFalse(os.path.exists(pageStyleFname))

        style.setPageStyle(page, self._exampleStyleDir)

        self.assertTrue(os.path.exists(pageStyleDir))
        self.assertTrue(os.path.exists(pageStyleFname))

        style.setPageStyle(page, style.getDefaultStyle())

        self.assertFalse(os.path.exists(pageStyleDir))
        self.assertFalse(os.path.exists(pageStyleFname))
开发者ID:qyqx,项目名称:outwiker,代码行数:21,代码来源:styles.py

示例9: generateHtml

# 需要导入模块: from outwiker.core.style import Style [as 别名]
# 或者: from outwiker.core.style.Style import getDefaultStyle [as 别名]
    def generateHtml (self, page):
        path = self.getHtmlPath ()

        if page.readonly and os.path.exists (path):
            # Если страница открыта только для чтения и html-файл уже существует, то покажем его
            return readTextFile (path)

        style = Style()
        stylepath = style.getPageStyle (page)

        try:
            tpl = HtmlTemplate (readTextFile (stylepath))
        except:
            MessageBox (_(u"Page style Error. Style by default is used"),
                        _(u"Error"),
                        wx.ICON_ERROR | wx.OK)

            tpl = HtmlTemplate (readTextFile (style.getDefaultStyle()))

        content = self._changeContentByEvent (self.page,
                                              PreprocessingParams (page.content),
                                              Application.onPreprocessing)

        if page.autoLineWrap:
            content = self._changeContentByEvent (self.page,
                                                  PreHtmlImprovingParams (content),
                                                  Application.onPreHtmlImproving)

            config = HtmlRenderConfig (Application.config)
            improverFactory = HtmlImproverFactory (Application)
            text = improverFactory[config.HTMLImprover.value].run (content)
        else:
            text = content

        userhead = u"<title>{}</title>".format (page.title)
        result = tpl.substitute (content = text,
                                 userhead = userhead)

        result = self._changeContentByEvent (self.page,
                                             PostprocessingParams (result),
                                             Application.onPostprocessing)
        return result
开发者ID:LihMeh,项目名称:outwiker,代码行数:44,代码来源:htmlpageview.py


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