From 2d7367d6d2517ffcacf2d7348e13e312c38687e1 Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Fri, 6 Jul 2007 15:04:14 -0500 Subject: [PATCH] Removed latex project --- moo/moopython/plugins/pyproject/Makefile.am | 3 - .../plugins/pyproject/projects/latex.py | 102 ------------------ .../pyproject/projects/ltxproj/__init__.py | 0 .../pyproject/projects/ltxproj/config.py | 47 -------- 4 files changed, 152 deletions(-) delete mode 100644 moo/moopython/plugins/pyproject/projects/latex.py delete mode 100644 moo/moopython/plugins/pyproject/projects/ltxproj/__init__.py delete mode 100644 moo/moopython/plugins/pyproject/projects/ltxproj/config.py diff --git a/moo/moopython/plugins/pyproject/Makefile.am b/moo/moopython/plugins/pyproject/Makefile.am index 480efca4..0da877b7 100644 --- a/moo/moopython/plugins/pyproject/Makefile.am +++ b/moo/moopython/plugins/pyproject/Makefile.am @@ -40,9 +40,6 @@ nobase_projects_DATA = \ projects/cproj/optdialog.py \ projects/cproj/parser.py \ projects/cproj/options.glade \ - projects/latex.py \ - projects/ltxproj/config.py \ - projects/ltxproj/__init__.py \ projects/python.py \ projects/pyproj/config.py \ projects/pyproj/__init__.py \ diff --git a/moo/moopython/plugins/pyproject/projects/latex.py b/moo/moopython/plugins/pyproject/projects/latex.py deleted file mode 100644 index 56782721..00000000 --- a/moo/moopython/plugins/pyproject/projects/latex.py +++ /dev/null @@ -1,102 +0,0 @@ -import gtk -import moo - -import mprj.utils -from mprj.simple import SimpleProject -from mprj.utils import print_error -from moo.utils import _, N_ - -from ltxproj.config import LatexConfig - - -_STOCK_LATEX = moo.utils.STOCK_BUILD -_STOCK_VIEW_DVI = moo.utils.STOCK_COMPILE - -_CMD_LATEX = 'latex' -_CMD_VIEW_DVI = 'viewdvi' - - -class LatexProject(SimpleProject): - __config__ = LatexConfig - - class DoCmd(object): - def __init__(self, obj, *args): - object.__init__(self) - self.obj = obj - self.args = args - def __call__(self, window): - return self.obj.do_command(window, *self.args) - - def init_ui(self): - SimpleProject.init_ui(self) - - commands = [ - ["Latex", _("LaTeX"), _STOCK_LATEX, "F8", _CMD_LATEX], - ["ViewDvi", _("View Dvi"), _STOCK_VIEW_DVI, "F9", _CMD_VIEW_DVI], - ] - - for c in commands: - self.add_action("LatexProject" + c[0], - display_name=c[1], label=c[1], - stock_id=c[2], accel=c[3], - callback=LatexProject.DoCmd(self, c[4])) - - editor = moo.edit.editor_instance() - xml = editor.get_ui_xml() - xml.insert_markup_after(self.merge_id, "Editor/Menubar", - "Project", """ - - - - - """ % (N_("_LaTeX"),)) - xml.insert_markup(self.merge_id, "Editor/Toolbar/BuildToolbar", - 0, """ - - - - """) - - def save_all(self, window): - docs = window.list_docs() - for d in docs: - if d.get_filename() and d.get_status() & moo.edit.EDIT_MODIFIED: - d.save() - - def do_command(self, window, cmd): - try: - self.before_command(window, cmd) and \ - self.exec_command(window, cmd) and \ - self.after_command(window, cmd) - except Exception, e: - mprj.utils.oops(window, e) - - - def before_command(self, window, cmd): - self.save_all(window) - return True - - def after_command(self, window, cmd): - return True - - def __cmd_simple(self, cmd, filename, window): - try: - working_dir, command = self.config.get_command(cmd, filename, self.topdir) - except Exception, e: - print_error(e) - return False - output = self.window.get_output() - output.clear() - window.present_output() - output.run_command(command, working_dir) - return True - - def exec_command(self, window, cmd): - doc = self.window.get_active_doc() - filename = doc and doc.get_filename() - return self.__cmd_simple(cmd, filename, window) - - -__project__ = LatexProject -__project_type__ = "LaTeX" -__project_version__ = "1.0" diff --git a/moo/moopython/plugins/pyproject/projects/ltxproj/__init__.py b/moo/moopython/plugins/pyproject/projects/ltxproj/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/moo/moopython/plugins/pyproject/projects/ltxproj/config.py b/moo/moopython/plugins/pyproject/projects/ltxproj/config.py deleted file mode 100644 index 7154d18d..00000000 --- a/moo/moopython/plugins/pyproject/projects/ltxproj/config.py +++ /dev/null @@ -1,47 +0,0 @@ -import os.path -import moo - -from mprj.utils import expand_command -from mprj.settings import * -from mprj.simple import SimpleProject, SimpleConfig - - -class Commands(Group): - __items__ = { - 'latex' : Command(default=['$(srcdir)', 'latex $(basename)']), - 'viewdvi' : Command(default=['$(srcdir)', 'kdvi $(base).dvi)']), - } - - -class LatexConfig(SimpleConfig): - __items__ = { - 'master' : String, - 'commands' : Commands - } - - def get_command(self, cmd, filename, topdir): - if self.master: - filename = self.master - if not os.path.isabs(filename): - filename = os.path.join(topdir, filename) - return expand_command(getattr(self.commands, cmd), - None, filename, topdir, None) - -if __name__ == '__main__': - from mprj.config import File - - s1 = """ - - norm.tex - - """ - - c = LatexConfig(File(s1)) - s2 = str(c.get_xml()) - - print s2 - - c = LatexConfig(File(s2)) - s3 = str(c.get_xml()) - - assert s2 == s3