def create_options(self): self.create_option( 'embed_vim', _('Embed Vim inside PIDA (requires restart)'), bool, True, _('Embed Vim inside PIDA (requires restart).'), )
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)
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'))
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'))
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()