Exemplo n.º 1
0
    def _addOtherTools(self):
        toolbar = self.mainWindow.toolbars[self._getName()]
        menu = self.toolsMenu
        actionController = self._application.actionController

        # Link
        actionController.getAction(LINK_STR_ID).setFunc(self._insertLink)

        actionController.appendMenuItem(LINK_STR_ID, menu)
        actionController.appendToolbarButton(
            LINK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "link.png"),
            fullUpdate=False)

        # Image
        actionController.getAction(IMAGE_STR_ID).setFunc(self._insertImage)

        actionController.appendMenuItem(IMAGE_STR_ID, menu)
        actionController.appendToolbarButton(
            IMAGE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "image.png"),
            fullUpdate=False)

        # Horizontal line
        actionController.getAction(HORLINE_STR_ID).setFunc(
            lambda param: self.replaceText(u"----"))

        actionController.appendMenuItem(HORLINE_STR_ID, menu)
        actionController.appendToolbarButton(
            HORLINE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "text_horizontalrule.png"),
            fullUpdate=False)

        # Текущая дата
        actionController.getAction(CURRENT_DATE).setFunc(
            lambda param: insertCurrentDate(self.mainWindow,
                                            self.codeEditor))

        actionController.appendMenuItem(CURRENT_DATE, menu)
        actionController.appendToolbarButton(
            CURRENT_DATE,
            toolbar,
            os.path.join(self.imagesDir, "date.png"),
            fullUpdate=False)

        self.toolsMenu.AppendSeparator()

        # Преобразовать некоторые символы в и их HTML-представление
        actionController.getAction(HTML_ESCAPE_STR_ID).setFunc(
            lambda param: self.escapeHtml())
        actionController.appendMenuItem(HTML_ESCAPE_STR_ID, menu)
Exemplo n.º 2
0
    def _addOtherTools(self):
        toolbar = self._toolbar_general
        menu = self.toolsMenu
        actionController = self._application.actionController

        # Link
        actionController.getAction(LINK_STR_ID).setFunc(self._insertLink)

        actionController.appendMenuItem(LINK_STR_ID, menu)
        actionController.appendToolbarButton(LINK_STR_ID,
                                             toolbar,
                                             os.path.join(
                                                 self.imagesDir, "link.png"),
                                             fullUpdate=False)

        # Image
        actionController.getAction(IMAGE_STR_ID).setFunc(self._insertImage)

        actionController.appendMenuItem(IMAGE_STR_ID, menu)
        actionController.appendToolbarButton(IMAGE_STR_ID,
                                             toolbar,
                                             os.path.join(
                                                 self.imagesDir, "image.png"),
                                             fullUpdate=False)

        # Horizontal line
        actionController.getAction(HORLINE_STR_ID).setFunc(
            lambda param: self.replaceText(u"----"))

        actionController.appendMenuItem(HORLINE_STR_ID, menu)
        actionController.appendToolbarButton(HORLINE_STR_ID,
                                             toolbar,
                                             os.path.join(
                                                 self.imagesDir,
                                                 "text_horizontalrule.png"),
                                             fullUpdate=False)

        # Текущая дата
        actionController.getAction(CURRENT_DATE).setFunc(
            lambda param: insertCurrentDate(self.mainWindow, self.codeEditor))

        actionController.appendMenuItem(CURRENT_DATE, menu)
        actionController.appendToolbarButton(CURRENT_DATE,
                                             toolbar,
                                             os.path.join(
                                                 self.imagesDir, "date.png"),
                                             fullUpdate=False)

        self.toolsMenu.AppendSeparator()

        # Преобразовать некоторые символы в и их HTML-представление
        actionController.getAction(HTML_ESCAPE_STR_ID).setFunc(
            lambda param: self.escapeHtml())
        actionController.appendMenuItem(HTML_ESCAPE_STR_ID, menu)
Exemplo n.º 3
0
    def __addOtherTools(self):
        """
        Добавить остальные инструменты
        """
        toolbar = self._application.mainWindow.toolbars[defines.TOOLBAR_WIKI_GENERAL]
        menu = self.toolsMenu
        actionController = self._application.actionController

        # Добавить миниатюру
        actionController.appendMenuItem(WikiThumbAction.stringId, menu)
        actionController.appendToolbarButton(
            WikiThumbAction.stringId,
            toolbar,
            os.path.join(self.imagesDir, "images.png"),
            fullUpdate=False)

        # Вставка ссылок
        actionController.getAction(LINK_STR_ID).setFunc(
            lambda param: insertLink(self._application))

        actionController.appendMenuItem(LINK_STR_ID, menu)
        actionController.appendToolbarButton(
            LINK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "link.png"),
            fullUpdate=False)

        # Вставка якоря
        actionController.getAction(ANCHOR_STR_ID).setFunc(
            lambda param: self.turnText(u"[[#", u"]]"))

        actionController.appendMenuItem(ANCHOR_STR_ID, menu)
        actionController.appendToolbarButton(
            ANCHOR_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "anchor.png"),
            fullUpdate=False)

        # Вставка горизонтальной линии
        actionController.getAction(HORLINE_STR_ID).setFunc(
            lambda param: self.replaceText(u"----"))

        actionController.appendMenuItem(HORLINE_STR_ID, menu)
        actionController.appendToolbarButton(
            HORLINE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "text_horizontalrule.png"),
            fullUpdate=False)

        # Вставка разрыва строки
        actionController.getAction(LINE_BREAK_STR_ID).setFunc(
            lambda param: self.replaceText(u"[[<<]]"))

        actionController.appendMenuItem(LINE_BREAK_STR_ID, menu)
        actionController.appendToolbarButton(
            LINE_BREAK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "linebreak.png"),
            fullUpdate=False)

        # Текущая дата
        actionController.getAction(CURRENT_DATE).setFunc(
            lambda param: insertCurrentDate(self.mainWindow,
                                            self.codeEditor))

        actionController.appendMenuItem(CURRENT_DATE, menu)
        actionController.appendToolbarButton(
            CURRENT_DATE,
            toolbar,
            os.path.join(self.imagesDir, "date.png"),
            fullUpdate=False)

        self.toolsMenu.AppendSeparator()

        # Преобразовать некоторые символы в и их HTML-представление
        actionController.getAction(HTML_ESCAPE_STR_ID).setFunc(
            lambda param: self.escapeHtml())
        actionController.appendMenuItem(HTML_ESCAPE_STR_ID, menu)
Exemplo n.º 4
0
    def __addOtherTools (self):
        """
        Добавить остальные инструменты
        """
        # Добавить миниатюру
        toolbar = self.mainWindow.toolbars[self._getName()]
        menu = self.toolsMenu

        self._application.actionController.appendMenuItem (WikiThumbAction.stringId, menu)
        self._application.actionController.appendToolbarButton (WikiThumbAction.stringId,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "images.png"),
                                                                fullUpdate=False)


        # Вставка ссылок
        self._application.actionController.getAction (LINK_STR_ID).setFunc (lambda param: insertLink (self._application))

        self._application.actionController.appendMenuItem (LINK_STR_ID, menu)
        self._application.actionController.appendToolbarButton (LINK_STR_ID,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "link.png"),
                                                                fullUpdate=False)


        # Вставка якоря
        self._application.actionController.getAction (ANCHOR_STR_ID).setFunc (lambda param: self.turnText (u"[[#", u"]]"))

        self._application.actionController.appendMenuItem (ANCHOR_STR_ID, menu)
        self._application.actionController.appendToolbarButton (ANCHOR_STR_ID,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "anchor.png"),
                                                                fullUpdate=False)


        # Вставка горизонтальной линии
        self._application.actionController.getAction (HORLINE_STR_ID).setFunc (lambda param: self.replaceText (u"----"))

        self._application.actionController.appendMenuItem (HORLINE_STR_ID, menu)
        self._application.actionController.appendToolbarButton (HORLINE_STR_ID,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "text_horizontalrule.png"),
                                                                fullUpdate=False)


        # Вставка разрыва страницы
        self._application.actionController.getAction (LINE_BREAK_STR_ID).setFunc (lambda param: self.replaceText (u"[[<<]]"))

        self._application.actionController.appendMenuItem (LINE_BREAK_STR_ID, menu)
        self._application.actionController.appendToolbarButton (LINE_BREAK_STR_ID,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "linebreak.png"),
                                                                fullUpdate=False)


        # Вставка формулы
        self._application.actionController.appendMenuItem (WikiEquationAction.stringId, menu)
        self._application.actionController.appendToolbarButton (WikiEquationAction.stringId,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "equation.png"),
                                                                fullUpdate=False)

        # Текущая дата
        self._application.actionController.getAction (CURRENT_DATE).setFunc (lambda param: insertCurrentDate (self.mainWindow,
                                                                                                              self.codeEditor))

        self._application.actionController.appendMenuItem (CURRENT_DATE, menu)
        self._application.actionController.appendToolbarButton (CURRENT_DATE,
                                                                toolbar,
                                                                os.path.join (self.imagesDir, "date.png"),
                                                                fullUpdate=False)

        self.toolsMenu.AppendSeparator()

        # Преобразовать некоторые символы в и их HTML-представление
        self._application.actionController.getAction (HTML_ESCAPE_STR_ID).setFunc (lambda param: self.escapeHtml ())
        self._application.actionController.appendMenuItem (HTML_ESCAPE_STR_ID, menu)
Exemplo n.º 5
0
    def _addOtherTools(self):
        """
        Добавить остальные инструменты
        """
        toolbar = self._application.mainWindow.toolbars[TOOLBAR_WEBPAGE]
        menu = self._menu

        # Вставить картинку
        self._application.actionController.getAction(IMAGE_STR_ID).setFunc(
            lambda param: self.turnText(u'<img src="', u'"/>'))

        self._application.actionController.appendMenuItem(IMAGE_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            IMAGE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "image.png"),
            fullUpdate=False)

        # Вставить ссылку
        self._application.actionController.getAction(LINK_STR_ID).setFunc(
            lambda param: insertLink(self._application))

        self._application.actionController.appendMenuItem(LINK_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            LINK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "link.png"),
            fullUpdate=False)

        # Вставить якорь
        self._application.actionController.getAction(ANCHOR_STR_ID).setFunc(
            lambda param: self.turnText(u'<a name="', u'"></a>'))

        self._application.actionController.appendMenuItem(ANCHOR_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            ANCHOR_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "anchor.png"),
            fullUpdate=False)

        # Вставить горизонтальную линию
        self._application.actionController.getAction(HORLINE_STR_ID).setFunc(
            lambda param: self.replaceText(u"<hr>"))

        self._application.actionController.appendMenuItem(
            HORLINE_STR_ID,
            menu)
        self._application.actionController.appendToolbarButton(
            HORLINE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "text_horizontalrule.png"),
            fullUpdate=False)

        # Вставка разрыва страницы
        self._application.actionController.getAction(LINE_BREAK_STR_ID).setFunc(
            lambda param: self.replaceText(u"<br>\n"))

        self._application.actionController.appendMenuItem(LINE_BREAK_STR_ID,
                                                          menu)
        self._application.actionController.appendToolbarButton(
            LINE_BREAK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "linebreak.png"),
            fullUpdate=False)

        # Текущая дата
        self._application.actionController.getAction(CURRENT_DATE).setFunc(
            lambda param: insertCurrentDate(self._application.mainWindow,
                                            self.codeEditor))

        self._application.actionController.appendMenuItem(CURRENT_DATE, menu)
        self._application.actionController.appendToolbarButton(
            CURRENT_DATE,
            toolbar,
            os.path.join(self.imagesDir, "date.png"),
            fullUpdate=False)

        self._menu.AppendSeparator()

        # Преобразовать символы в их HTML-представление
        self._application.actionController.getAction(HTML_ESCAPE_STR_ID).setFunc(
            lambda param: self.escapeHtml())
        self._application.actionController.appendMenuItem(
            HTML_ESCAPE_STR_ID,
            menu)
Exemplo n.º 6
0
    def _addOtherTools(self):
        """
        Добавить остальные инструменты
        """
        toolbar = self._application.mainWindow.toolbars[TOOLBAR_WEBPAGE]
        menu = self._menu

        # Вставить картинку
        self._application.actionController.getAction(IMAGE_STR_ID).setFunc(
            lambda param: self.turnText(u'<img src="', u'"/>'))

        self._application.actionController.appendMenuItem(IMAGE_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            IMAGE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "image.png"),
            fullUpdate=False)

        # Вставить ссылку
        self._application.actionController.getAction(LINK_STR_ID).setFunc(
            lambda param: insertLink(self._application))

        self._application.actionController.appendMenuItem(LINK_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            LINK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "link.png"),
            fullUpdate=False)

        # Вставить якорь
        self._application.actionController.getAction(ANCHOR_STR_ID).setFunc(
            lambda param: self.turnText(u'<a name="', u'"></a>'))

        self._application.actionController.appendMenuItem(ANCHOR_STR_ID, menu)
        self._application.actionController.appendToolbarButton(
            ANCHOR_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "anchor.png"),
            fullUpdate=False)

        # Вставить горизонтальную линию
        self._application.actionController.getAction(HORLINE_STR_ID).setFunc(
            lambda param: self.replaceText(u"<hr>"))

        self._application.actionController.appendMenuItem(
            HORLINE_STR_ID,
            menu)
        self._application.actionController.appendToolbarButton(
            HORLINE_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "text_horizontalrule.png"),
            fullUpdate=False)

        # Вставка разрыва страницы
        self._application.actionController.getAction(LINE_BREAK_STR_ID).setFunc(
            lambda param: self.replaceText(u"<br>\n"))

        self._application.actionController.appendMenuItem(LINE_BREAK_STR_ID,
                                                          menu)
        self._application.actionController.appendToolbarButton(
            LINE_BREAK_STR_ID,
            toolbar,
            os.path.join(self.imagesDir, "linebreak.png"),
            fullUpdate=False)

        # Текущая дата
        self._application.actionController.getAction(CURRENT_DATE).setFunc(
            lambda param: insertCurrentDate(self._application.mainWindow,
                                            self.codeEditor))

        self._application.actionController.appendMenuItem(CURRENT_DATE, menu)
        self._application.actionController.appendToolbarButton(
            CURRENT_DATE,
            toolbar,
            os.path.join(self.imagesDir, "date.png"),
            fullUpdate=False)

        self._menu.AppendSeparator()

        # Преобразовать символы в их HTML-представление
        self._application.actionController.getAction(HTML_ESCAPE_STR_ID).setFunc(
            lambda param: self.escapeHtml())
        self._application.actionController.appendMenuItem(
            HTML_ESCAPE_STR_ID,
            menu)