示例#1
0
文件: vim.py 项目: xmonader/pida
 def create_options(self):
     self.create_option(
         'embed_vim',
         _('Embed Vim inside PIDA (requires restart)'),
         bool,
         True,
         _('Embed Vim inside PIDA (requires restart).'),
     )
示例#2
0
文件: vim.py 项目: 9060/spdiff
 def pre_start(self):
     """Start the editor"""
     self.started = False
     self._create_initscript()
     self._cb = VimCallback(self)
     self._com = VimCom(self._cb)
     self._view = VimView(self)
     self.boss.cmd('window', 'add_view', paned='Editor', view=self._view)
     self._documents = {}
     self._current = None
     self._sign_index = 0
     self._signs = {}
     self._current_line = 1
     success = self._view.run()
     if not success:
         err = _('There was a problem running the "gvim" '
                          'executable. This is usually because it is not '
                          'installed. Please check that you can run "gvim" '
                          'from the command line.')
         self.error_dlg(err)
         raise RuntimeError(err)
示例#3
0
 def pre_start(self):
     """Start the editor"""
     self.started = False
     self._create_initscript()
     self._cb = VimCallback(self)
     self._com = VimCom(self._cb)
     self._view = VimView(self)
     self.boss.cmd('window', 'add_view', paned='Editor', view=self._view)
     self._documents = {}
     self._current = None
     self._sign_index = 0
     self._signs = {}
     self._current_line = 1
     success = self._view.run()
     if not success:
         err = _('There was a problem running the "gvim" '
                 'executable. This is usually because it is not '
                 'installed. Please check that you can run "gvim" '
                 'from the command line.')
         self.error_dlg(err)
         raise RuntimeError(err)
示例#4
0
文件: vim.py 项目: 9060/spdiff
 def hide_sign(self, type, filename, line):
     try:
         index = self._del_sign(type, filename, line)
         self._com.hide_sign(self.server, index, filename)
     except KeyError:
         self.window.error_dlg(_('Tried to remove non-existent sign'))
示例#5
0
 def hide_sign(self, type, filename, line):
     try:
         index = self._del_sign(type, filename, line)
         self._com.hide_sign(self.server, index, filename)
     except KeyError:
         self.window.error_dlg(_('Tried to remove non-existent sign'))
示例#6
0
文件: vim.py 项目: xmonader/pida
 def hide_sign(self, type, filename, line):
     try:
         index = self._signs.pop((filename, line, type))
         self._com.hide_sign(index, filename)
     except KeyError:
         self.window.error_dlg(_('Tried to remove non-existent sign'))
示例#7
0
文件: vim.py 项目: xmonader/pida
from pida.core.environment import get_data_path
from pida.core.editors import EditorService, _
from pida.core.options import OptionsConfig, choices
from pida.ui.views import PidaView

from .embed import VimEmbedWidget, VimStarter
from .client import get_vim

_ignore = dict(reply_handler=lambda *a: None,
               error_handler=lambda *a: None)
#Evil handling
_ignore = {}

VIM_LAUNCH_ERR = _('There was a problem running the "gvim" '
                   'executable. This is usually because it is not '
                   'installed. Please check that you can run "gvim" '
                   'from the command line.')


class VimView(PidaView):

    def create_ui(self):
        if self.svc.opt('embed_vim'):
            vim_factory = VimEmbedWidget
        else:
            vim_factory = VimStarter
        self._vim = vim_factory('gvim', self.svc.script_path)
        self.add_main_widget(self._vim)

    def run(self):
        return self._vim.run()