Example #1
0
    def Save (self):
        """
        Сохранить текущую страницу
        """
        if self.__saveProcessing:
            return

        if self.__pageView != None:
            if not pageExists (Application.selectedPage.root):
                # Нет папки с деревом
                self.__saveProcessing = True
                MessageBox (_(u"Can't save page. Wiki folder not exists. Wiki will be closed."), _("Error"), wx.OK | wx.ICON_ERROR)
                self.__saveProcessing = False

                Application.wikiroot = None
                return

            if not pageExists (Application.selectedPage):
                # Похоже, страница удалена вручную, перезагрузим вики
                self.__saveProcessing = True
                MessageBox (_(u"Can't save page. Page folder not exists. Wiki will be reloaded."), _("Error"), wx.OK | wx.ICON_ERROR)
                self.__saveProcessing = False

                self.__reloadWiki()
                return

            self.__pageView.Save()
Example #2
0
    def Save(self):
        """
        Сохранить текущую страницу
        """
        if self.__saveProcessing:
            return

        if (self.__pageView is not None and
                self._application.selectedPage is not None):
            if not pageExists(self._application.selectedPage.root):
                # Нет папки с деревом
                self.__saveProcessing = True
                showError(self._application.mainWindow,
                          _(u"Can't save page. Wiki folder not exists. Wiki will be closed."))
                self.__saveProcessing = False

                self._application.wikiroot = None
                return

            if not pageExists(self._application.selectedPage):
                # Похоже, страница удалена вручную, перезагрузим вики
                self.__saveProcessing = True
                showError(self._application.mainWindow,
                          _(u"Can't save page. Page folder not exists. Wiki will be reloaded."))
                self.__saveProcessing = False

                try:
                    self.__reloadWiki()
                except OSError:
                    self._application.wikiroot = None

                return

            self.__pageView.Save()
Example #3
0
    def Save(self):
        """
        Сохранить текущую страницу
        """
        if self.__saveProcessing:
            return

        if self.__pageView is not None:
            if not pageExists(self._application.selectedPage.root):
                # Нет папки с деревом
                self.__saveProcessing = True
                showError(self._application.mainWindow,
                          _(u"Can't save page. Wiki folder not exists. Wiki will be closed."))
                self.__saveProcessing = False

                self._application.wikiroot = None
                return

            if not pageExists(self._application.selectedPage):
                # Похоже, страница удалена вручную, перезагрузим вики
                self.__saveProcessing = True
                showError(self._application.mainWindow,
                          _(u"Can't save page. Page folder not exists. Wiki will be reloaded."))
                self.__saveProcessing = False

                try:
                    self.__reloadWiki()
                except OSError:
                    self._application.wikiroot = None

                return

            self.__pageView.Save()
Example #4
0
    def Save(self):
        """
        Сохранить текущую страницу
        """
        if self.__saveProcessing:
            return

        if self.__pageView is not None:
            if not pageExists(Application.selectedPage.root):
                # Нет папки с деревом
                self.__saveProcessing = True
                MessageBox(
                    _(u"Can't save page. Wiki folder not exists. Wiki will be closed."
                      ), _("Error"), wx.OK | wx.ICON_ERROR)
                self.__saveProcessing = False

                Application.wikiroot = None
                return

            if not pageExists(Application.selectedPage):
                # Похоже, страница удалена вручную, перезагрузим вики
                self.__saveProcessing = True
                MessageBox(
                    _(u"Can't save page. Page folder not exists. Wiki will be reloaded."
                      ), _("Error"), wx.OK | wx.ICON_ERROR)
                self.__saveProcessing = False

                self.__reloadWiki()
                return

            self.__pageView.Save()
Example #5
0
def editPage (parentWnd, currentPage):
    """
    Вызвать диалог для редактирования страницы
    parentWnd - родительское окно
    currentPage - страница для редактирования
    """
    if currentPage.readonly:
        raise outwiker.core.exceptions.ReadonlyException

    if not pageExists (currentPage):
        MessageBox (_(u'Page "%s" not found') % currentPage.display_title,
                    _(u"Error"),
                    wx.OK | wx.ICON_ERROR)
        return

    with EditPageDialog (parentWnd, currentPage) as dlg:
        if dlg.ShowModal() == wx.ID_OK:
            try:
                currentPage.display_title = dlg.pageTitle
            except EnvironmentError as e:
                MessageBox (_(u"Can't rename page\n") + unicode (e),
                            _(u"Error"),
                            wx.ICON_ERROR | wx.OK)

            if not dlg.setPageProperties (currentPage):
                return None
Example #6
0
def editPage (parentWnd, currentPage):
    """
    Вызвать диалог для редактирования страницы
    parentWnd - родительское окно
    currentPage - страница для редактирования
    """
    if currentPage.readonly:
        raise outwiker.core.exceptions.ReadonlyException

    if not pageExists (currentPage):
        MessageBox (_(u'Page "%s" not found') % currentPage.title,
                    _(u"Error"),
                    wx.OK | wx.ICON_ERROR)
        return

    dlg = EditPageDialog (currentPage, currentPage.parent, parent = parentWnd)

    if dlg.ShowModal() == wx.ID_OK:
        currentPage.tags = dlg.tags
        currentPage.icon = dlg.icon

        try:
            currentPage.title = dlg.pageTitle
        except OSError as e:
            outwiker.core.commands.MessageBox (_(u"Can't rename page\n") + unicode (e), _(u"Error"), wx.ICON_ERROR | wx.OK)

        try:
            Style().setPageStyle (currentPage, dlg.style)
        except IOError as e:
            outwiker.core.commands.MessageBox (_(u"Can't change page style\n") + unicode (e), _(u"Error"), wx.ICON_ERROR | wx.OK)

        currentPage.root.selectedPage = currentPage

    dlg.Destroy()
Example #7
0
 def Save(self):
     """
     Сохранить настройки страницы
     """
     if (self.page is not None and not self.page.isRemoved
             and pageExists(self.page)):
         self.__saveSearchPhrase()
         self.__saveSearchTags()
         self.__saveSearchTagsStrategy()
         self.__saveSortStrategy()
Example #8
0
 def Save(self):
     """
     Сохранить настройки страницы
     """
     if (self.page is not None and
             not self.page.isRemoved and
             pageExists(self.page)):
         self.__saveSearchPhrase()
         self.__saveSearchTags()
         self.__saveSearchTagsStrategy()
         self.__saveSortStrategy()
Example #9
0
    def Save(self):
        """
        Сохранить страницу
        """
        if self.page is None:
            return

        if not pageExists(self.page):
            return

        if not self.page.isRemoved:
            self.checkForExternalEditAndSave()
Example #10
0
    def __onPageSelect (self, page):
        """
        Событие при выборе страницы
        """
        if page is not None and not pageExists (page):
            MessageBox (_(u"Can't open page. Page folder not exists"), _("Error"), wx.OK | wx.ICON_ERROR)
            Application.selectedPage = None
            return

        self.__updatePageView (page)
        self.__updatePageInfo (page)
        self.bookmarkButton.Enable (page is not None)
Example #11
0
    def Save (self):
        """
        Сохранить страницу
        """
        if self.page is None:
            return

        if not pageExists (self.page):
            return

        if not self.page.isRemoved:
            self.checkForExternalEditAndSave()
Example #12
0
    def __onPageSelect(self, page):
        """
        Событие при выборе страницы
        """
        if page is not None and not pageExists(page):
            showError(self._application.mainWindow,
                      _(u"Can't open page. Page folder not exists"))
            self.__reloadWiki()
            return

        self.__updatePageView(page)
        self.__updatePageInfo(page)
        self.bookmarkButton.Enable(page is not None)
Example #13
0
    def __onPageSelect(self, page):
        """
        Событие при выборе страницы
        """
        if page is not None and not pageExists(page):
            showError(self._application.mainWindow,
                      _(u"Can't open page. Page folder not exists"))
            self.__reloadWiki()
            return

        self.__updatePageView(page)
        self.__updatePageInfo(page)
        self.bookmarkButton.Enable(page is not None)
Example #14
0
    def __onPageSelect(self, page):
        """
        Событие при выборе страницы
        """
        if page is not None and not pageExists(page):
            MessageBox(_(u"Can't open page. Page folder not exists"),
                       _("Error"), wx.OK | wx.ICON_ERROR)
            self.__reloadWiki()
            return

        self.__updatePageView(page)
        self.__updatePageInfo(page)
        self.bookmarkButton.Enable(page is not None)
Example #15
0
def editPage(parentWnd, currentPage):
    """
    Вызвать диалог для редактирования страницы
    parentWnd - родительское окно
    currentPage - страница для редактирования
    """
    if currentPage.readonly:
        raise outwiker.core.exceptions.ReadonlyException

    if not pageExists(currentPage):
        showError(Application.mainWindow,
                  _(u'Page "%s" not found') % currentPage.display_title)
        return

    with EditPageDialog(parentWnd, currentPage, Application) as dlg:
        if dlg.ShowModal() == wx.ID_OK:
            renamePage(currentPage, dlg.pageTitle)
            if not dlg.setPageProperties(currentPage):
                return None
Example #16
0
def editPage(parentWnd, currentPage):
    """
    Вызвать диалог для редактирования страницы
    parentWnd - родительское окно
    currentPage - страница для редактирования
    """
    if currentPage.readonly:
        raise outwiker.core.exceptions.ReadonlyException

    if not pageExists(currentPage):
        showError(Application.mainWindow,
                  _(u'Page "%s" not found') % currentPage.display_title)
        return

    with EditPageDialog(parentWnd, currentPage, Application) as dlg:
        if dlg.ShowModal() == wx.ID_OK:
            renamePage(currentPage, dlg.pageTitle)
            if not dlg.setPageProperties(currentPage):
                return None