Esempio n. 1
0
    def _updateResult(self):
        """
        Подготовить и показать HTML текущей страницы
        """
        assert self._currentpage is not None

        status_item = 0

        setStatusText(_(u"Page rendered. Please wait…"), status_item)
        self._application.onHtmlRenderingBegin(self._currentpage,
                                               self.htmlWindow)

        try:
            html = self.generateHtml(self._currentpage)

            if (self._oldPage != self._currentpage
                    or self._oldHtmlResult != html):
                path = self.getHtmlPath()

                if not self._currentpage.readonly:
                    writeTextFile(path, html)

                self.htmlWindow.LoadPage(path)
                self._oldHtmlResult = html
                self._oldPage = self._currentpage
        except IOError as e:
            # TODO: Проверить под Windows
            MessageBox(
                _(u"Can't save file\n\n{}").format(
                    unicode(e.filename,
                            getOS().filesEncoding)), _(u"Error"),
                wx.ICON_ERROR | wx.OK)
        except OSError as e:
            MessageBox(
                _(u"Can't save file\n\n{}").format(
                    unicode(e.strerror,
                            getOS().filesEncoding)), _(u"Error"),
                wx.ICON_ERROR | wx.OK)

        setStatusText(u"", status_item)
        self._application.onHtmlRenderingEnd(self._currentpage,
                                             self.htmlWindow)
Esempio n. 2
0
    def _updateResult (self):
        """
        Подготовить и показать HTML текущей страницы
        """
        assert self._currentpage is not None

        status_item = 0

        setStatusText (_(u"Page rendered. Please wait…"), status_item)
        self._application.onHtmlRenderingBegin (self._currentpage, self.htmlWindow)

        try:
            html = self.generateHtml (self._currentpage)

            if (self._oldPage != self._currentpage or
                    self._oldHtmlResult != html):
                path = self.getHtmlPath()

                if not self._currentpage.readonly:
                    writeTextFile (path, html)

                self.htmlWindow.LoadPage (path)
                self._oldHtmlResult = html
                self._oldPage = self._currentpage
        except IOError as e:
            # TODO: Проверить под Windows
            MessageBox (_(u"Can't save file\n\n{}").format (unicode (e.filename, getOS().filesEncoding)),
                        _(u"Error"),
                        wx.ICON_ERROR | wx.OK)
        except OSError as e:
            MessageBox (_(u"Can't save file\n\n{}").format (unicode (e.strerror, getOS().filesEncoding)),
                        _(u"Error"),
                        wx.ICON_ERROR | wx.OK)

        setStatusText (u"", status_item)
        self._application.onHtmlRenderingEnd (self._currentpage, self.htmlWindow)
Esempio n. 3
0
 def _saveCustomDict(self):
     text = self._sanitizeDictText(self.customDict.GetValue())
     try:
         writeTextFile(self._getCustomDictFileName(), text)
     except (IOError, SystemError):
         pass
Esempio n. 4
0
 def _saveCustomDict (self):
     text = self._sanitizeDictText (self.customDict.GetValue())
     try:
         writeTextFile (self._getCustomDictFileName(), text)
     except (IOError, SystemError):
         pass