added Application.run_external() and added latex spell checking
--HG-- branch : pmacs2
This commit is contained in:
parent
3cb04bfb18
commit
d74ff84fa3
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
import curses, curses.ascii, getpass, os, re, string, sets, sys, termios, time
|
||||
import traceback
|
||||
from subprocess import Popen, PIPE, STDOUT
|
||||
|
||||
import buffer, bufferlist, color, completer, keyinput, method, minibuffer, mode
|
||||
import util, window
|
||||
|
@ -22,6 +23,7 @@ def run(buffers, jump_to_line=None, init_mode=None):
|
|||
return retval
|
||||
|
||||
def run_app(stdscr, buffers, jump_to_line=None, init_mode=None):
|
||||
curses.def_shell_mode()
|
||||
a = Application(stdscr, buffers, jump_to_line, init_mode)
|
||||
a.run()
|
||||
|
||||
|
@ -200,6 +202,7 @@ class Application(object):
|
|||
#curses.halfdelay(5)
|
||||
curses.noecho()
|
||||
curses.nonl()
|
||||
curses.def_prog_mode()
|
||||
|
||||
# this sets up a mode, as well as optionally adding information on when to
|
||||
# auto-load the mode
|
||||
|
@ -504,14 +507,23 @@ class Application(object):
|
|||
def clear_highlighted_ranges(self):
|
||||
self.highlighted_ranges = []
|
||||
|
||||
def run_external(self, *args):
|
||||
curses.reset_shell_mode()
|
||||
pipe = Popen(args)
|
||||
pipe.wait()
|
||||
curses.reset_prog_mode()
|
||||
self.win.redrawwin()
|
||||
self.draw()
|
||||
|
||||
# full screen drawer
|
||||
def draw(self, err=""):
|
||||
try:
|
||||
self.draw_slots()
|
||||
self.draw_input_bar()
|
||||
self.draw_cursor()
|
||||
self.win.noutrefresh()
|
||||
curses.doupdate()
|
||||
#self.win.noutrefresh()
|
||||
#curses.doupdate()
|
||||
curses.refresh()
|
||||
except Exception, e:
|
||||
# ok, so there was a problem...
|
||||
# let's see if the screen changed sizes and if so, resize our slots
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import commands, os
|
||||
import commands, curses, os
|
||||
import color, method, mode
|
||||
from lex import Grammar, PatternRule, RegionRule
|
||||
from mode.text import TextInsertSpace
|
||||
|
@ -38,6 +38,7 @@ class Latex(mode.Fundamental):
|
|||
self.add_action_and_bindings(LatexInsertSpace(), ('SPACE',))
|
||||
self.add_action_and_bindings(LatexBuildPdf(), ("C-c C-p",))
|
||||
self.add_action_and_bindings(LatexViewPdf(), ('C-c C-v',))
|
||||
self.add_action(LatexCheckSpelling())
|
||||
|
||||
class LatexBuild(method.Method):
|
||||
'''Insert a pair of LaTeX-style single-quotes into the buffer'''
|
||||
|
@ -109,4 +110,9 @@ class LatexInsertBraces(method.Method):
|
|||
class LatexInsertSpace(TextInsertSpace):
|
||||
pass
|
||||
|
||||
class LatexCheckSpelling(method.Method):
|
||||
"""Check the spelling of the document via ispell -t"""
|
||||
def _execute(self, w, **vargs):
|
||||
w.application.run_external('ispell', '-t', w.buffer.path)
|
||||
|
||||
install = Latex.install
|
||||
|
|
Loading…
Reference in New Issue