Esempio n. 1
0
    def _process(self, *args, **kwargs):
        global _
        _ = get_()

        try:
            return func(self, *args, **kwargs)
        except TemplateNotFound as e:
            text = _(u'Snippet "{name}" not found').format(
                name=unicode(e.name)
            )
            raise SnippetException(text)
        except TemplateSyntaxError as e:
            text = _(u'Snippet error at line {line}:\n{text}').format(
                line=e.lineno,
                text=unicode(e.message)
            )
            raise SnippetException(text)
        except EnvironmentError as e:
            text = _(u'Snippet reading error:\n{text}').format(
                text=unicode(e)
            )
            raise SnippetException(text)
        except BaseException as e:
            text = _(u'Snippet processing error:\n{text}').format(
                text=unicode(e)
            )
            raise SnippetException(text)
Esempio n. 2
0
    def __init__(self, parser, snippets_dir, application):
        super(CommandSnip, self).__init__(parser)
        self._snippets_dir = snippets_dir
        self._application = application

        global _
        _ = get_()
Esempio n. 3
0
def openHelp():
    global _
    _ = get_()

    help_dir = _(u'help/en')
    help_path = os.path.join(getPluginPath(), help_dir, u'__content.html')
    getOS().startFile(help_path)
Esempio n. 4
0
    def __init__(self, parent):
        super(VariablesDialog,
              self).__init__(parent,
                             style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        global _
        _ = get_()

        self._shortTemplateName = None
        self._createGUI()
        self.SetTitle(u'Snippet variables')
Esempio n. 5
0
 def __init__(self, application):
     global _
     _ = get_()
     self._application = application
     self._snippetChanged = False
     self._dialog = EditSnippetsDialog(self._application.mainWindow)
     self._config = SnippetsConfig(self._application.config)
     self._dialog.SetClientSize(
         (self._config.editDialogWidth, self._config.editDialogHeight))
     self._bind()
Esempio n. 6
0
 def __init__(self, application):
     global _
     _ = get_()
     self._application = application
     self._snippetChanged = False
     self._dialog = EditSnippetsDialog(self._application.mainWindow)
     self._config = SnippetsConfig(self._application.config)
     self._dialog.SetClientSize((self._config.editDialogWidth,
                                 self._config.editDialogHeight))
     self._bind()
Esempio n. 7
0
    def initialize(self):
        global _
        _ = get_()

        if self._application.mainWindow is not None:
            self._mainMenu = self._application.mainWindow.mainMenu
            self._menuName = _(u'Snippets')
            self._createMenu()
            self._varDialogController.onFinishDialog += self._onFinishDialog
            self._application.customEvents.bind(EVENT_UPDATE_MENU,
                                                self._onMenuUpdate)
Esempio n. 8
0
    def __init__(self, parent):
        super(VariablesDialog, self).__init__(
            parent,
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        global _
        _ = get_()

        self._shortTemplateName = None
        self._createGUI()
        self.SetTitle(u'Snippet variables')
Esempio n. 9
0
 def __init__(self, application):
     global _
     _ = get_()
     self._application = application
     self._snippetChanged = False
     self._dialog = EditSnippetsDialog(self._application.mainWindow)
     self._config = SnippetsConfig(self._application.config)
     self._mainWindowconfig = MainWindowConfig(self._application.config)
     self._dialog.SetClientSize((self._config.editDialogWidth,
                                 self._config.editDialogHeight))
     self._dialog.SetBackgroundColour(self._mainWindowconfig.mainPanesBackgroundColor.value)
     self._bind()
Esempio n. 10
0
 def __init__(self, application):
     global _
     _ = get_()
     self._application = application
     self._snippetChanged = False
     self._dialog = EditSnippetsDialog(self._application.mainWindow)
     self._config = SnippetsConfig(self._application.config)
     self._mainWindowconfig = MainWindowConfig(self._application.config)
     self._dialog.SetClientSize(
         (self._config.editDialogWidth, self._config.editDialogHeight))
     self._dialog.SetBackgroundColour(
         self._mainWindowconfig.mainPanesBackgroundColor.value)
     self._bind()
Esempio n. 11
0
    def initialize(self):
        global _
        _ = get_()

        if self._application.mainWindow is not None:
            self._mainMenu = self._application.mainWindow.mainMenu
            self._menuName = _(u'Snippets')
            self._createMenu()
            self._varDialogController.onFinishDialogEvent += self._onFinishDialog
            self._application.customEvents.bind(defines.EVENT_UPDATE_MENU,
                                                self._onMenuUpdate)
            self._application.customEvents.bind(defines.EVENT_RUN_SNIPPET,
                                                self._onRunSnippet)
Esempio n. 12
0
    def __init__(self, parent):
        super().__init__(parent,
                         style=wx.CAPTION | wx.CLOSE | wx.SYSTEM_MENU
                         | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.CLOSE_BOX
                         | wx.RESIZE_BORDER | wx.FRAME_TOOL_WINDOW
                         | wx.FRAME_NO_TASKBAR | wx.FRAME_FLOAT_ON_PARENT)
        global _
        _ = get_()

        self.ICON_WIDTH = 16
        self.ICON_HEIGHT = 16

        self._imagesPath = getImagesPath()
        self._dirImageId = None
        self._snippetImageId = None

        self.addGroupBtn = None
        self.addSnippetBtn = None

        self._varMenuItems = [
            (_(u'Selected text'), defines.VAR_SEL_TEXT),
            (_(u'Current date'), defines.VAR_DATE),
            (_(u'Page title'), defines.VAR_TITLE),
            (_(u'Page type'), defines.VAR_PAGE_TYPE),
            (_(u'Page tags list'), defines.VAR_TAGS),
            (_(u'Attachments path'), defines.VAR_ATTACH),
            (_(u'Path to page'), defines.VAR_FOLDER),
            (_(u'Relative page path'), defines.VAR_SUBPATH),
            (_(u'Page creation date'), defines.VAR_DATE_CREATING),
            (_(u'Page modification date'), defines.VAR_DATE_EDITIND),
            (_(u'Page Id'), defines.VAR_PAGE_ID),
            (_(u'Attachments list'), defines.VAR_ATTACHLIST),
            (_(u'Child pages'), defines.VAR_CHILDLIST),
        ]

        self._blocksMenuItems = [
            (_('{% if %}'), (u'{% if %}', '{% elif %}{% else %}{% endif %}')),
            (_('{% include %}'), (u"{% include '", u"' %}")),
            (_('{# comment #}'), (u'{# ', ' #}')),
        ]

        self._createGUI()
        self.SetTitle(_(u'Snippets management'))
        self.disableSnippetEditor()
Esempio n. 13
0
    def _process(self, *args, **kwargs):
        global _
        _ = get_()

        try:
            return func(self, *args, **kwargs)
        except TemplateNotFound as e:
            text = _(u'Snippet "{name}" not found').format(name=e.name)
            raise SnippetException(text)
        except TemplateSyntaxError as e:
            text = _(u'Snippet error at line {line}:\n{text}').format(
                line=e.lineno, text=e.message)
            raise SnippetException(text)
        except EnvironmentError as e:
            text = _(u'Snippet reading error:\n{text}').format(text=str(e))
            raise SnippetException(text)
        except BaseException as e:
            text = _(u'Snippet processing error:\n{text}').format(text=str(e))
            raise SnippetException(text)
Esempio n. 14
0
    def __init__(self, parent):
        super().__init__(
            parent,
            style=wx.CAPTION | wx.CLOSE | wx.SYSTEM_MENU | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.CLOSE_BOX | wx.RESIZE_BORDER | wx.FRAME_TOOL_WINDOW | wx.FRAME_NO_TASKBAR | wx.FRAME_FLOAT_ON_PARENT
        )
        global _
        _ = get_()

        self.ICON_WIDTH = 16
        self.ICON_HEIGHT = 16

        self._imagesPath = getImagesPath()
        self._dirImageId = None
        self._snippetImageId = None

        self.addGroupBtn = None
        self.addSnippetBtn = None

        self._varMenuItems = [
            (_(u'Selected text'), defines.VAR_SEL_TEXT),
            (_(u'Current date'), defines.VAR_DATE),
            (_(u'Page title'), defines.VAR_TITLE),
            (_(u'Page type'), defines.VAR_PAGE_TYPE),
            (_(u'Page tags list'), defines.VAR_TAGS),
            (_(u'Attachments path'), defines.VAR_ATTACH),
            (_(u'Path to page'), defines.VAR_FOLDER),
            (_(u'Relative page path'), defines.VAR_SUBPATH),
            (_(u'Page creation date'), defines.VAR_DATE_CREATING),
            (_(u'Page modification date'), defines.VAR_DATE_EDITIND),
            (_(u'Page Id'), defines.VAR_PAGE_ID),
            (_(u'Attachments list'), defines.VAR_ATTACHLIST),
            (_(u'Child pages'), defines.VAR_CHILDLIST),
        ]

        self._blocksMenuItems = [
            (_('{% if %}'), (u'{% if %}', '{% elif %}{% else %}{% endif %}')),
            (_('{% include %}'), (u"{% include '", u"' %}")),
            (_('{# comment #}'), (u'{# ', ' #}')),
        ]

        self._createGUI()
        self.SetTitle(_(u'Snippets management'))
        self.disableSnippetEditor()
Esempio n. 15
0
 def __init__(self, application):
     super(RunRecentSnippet, self).__init__()
     self._application = application
     global _
     _ = get_()
Esempio n. 16
0
 def __init__(self, application):
     super(EditSnippetsAction, self).__init__()
     self._application = application
     global _
     _ = get_()
     self._dialogController = EditSnippetsDialogController(application)
Esempio n. 17
0
 def __init__(self, application):
     super(UpdateMenuAction, self).__init__()
     self._application = application
     global _
     _ = get_()
Esempio n. 18
0
 def __init__(self, application):
     super(RunRecentSnippet, self).__init__()
     self._application = application
     global _
     _ = get_()
Esempio n. 19
0
 def __init__(self, application):
     super(OpenHelpAction, self).__init__()
     global _
     _ = get_()
Esempio n. 20
0
 def __init__(self, application):
     super(OpenHelpAction, self).__init__()
     global _
     _ = get_()
Esempio n. 21
0
 def __init__(self, application):
     super(EditSnippetsAction, self).__init__()
     self._application = application
     global _
     _ = get_()
     self._dialogController = EditSnippetsDialogController(application)