From db5f123fd099011b18e72b051ed352b1ad132db9 Mon Sep 17 00:00:00 2001 From: Raphael Ackermann Date: Mon, 7 Jan 2008 08:04:45 +0000 Subject: [PATCH] 2008-01-07 Raphael Ackermann * src/docgen/ODFDoc.py: remove duplicate import * src/docgen/LaTeXDoc.py :added support for opening latex editor 0001536: not possible to select latex editor like kile to open a latex file automatically svn: r9738 --- ChangeLog | 6 ++++++ src/docgen/LaTeXDoc.py | 31 ++++++++++++++++++++++--------- src/docgen/ODFDoc.py | 1 - 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7bd411669..ce9bbffee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-07 Raphael Ackermann + * src/docgen/ODFDoc.py: remove duplicate import + * src/docgen/LaTeXDoc.py :added support for opening latex editor + 0001536: not possible to select latex editor like kile to open a latex file + automatically + 2008-01-06 Brian Matherly * src/Filters/_SearchFilter.py: 0001521: Filters work when tested, but not in side bar diff --git a/src/docgen/LaTeXDoc.py b/src/docgen/LaTeXDoc.py index bc666a6ef..579e23247 100644 --- a/src/docgen/LaTeXDoc.py +++ b/src/docgen/LaTeXDoc.py @@ -3,6 +3,7 @@ # # Copyright (C) 2000-2006 Donald N. Allingham # Copyright (C) 2007 Brian G. Matherly +# Copyright (C) 2008 Raphael Ackermann # # Modifications and feature additions: # 2002-2003 Donald A. Peterson @@ -45,6 +46,10 @@ import BaseDoc from PluginUtils import register_text_doc import ImgManip import Errors +import Mime +import Utils + +_apptype = 'text/x-tex' #------------------------------------------------------------------------ # @@ -298,6 +303,9 @@ class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc): self.f.write('\\end{enumerate}\n') self.f.write('\n\\end{document}\n') self.f.close() + if self.print_req: + app = Mime.get_application(_apptype) + Utils.launch(app[0], self.filename) def end_page(self): """Issue a new page command""" @@ -510,14 +518,19 @@ class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc): #------------------------------------------------------------------------ # -# Register the document generator with the system +# Register plugins # #------------------------------------------------------------------------ -register_text_doc( - name=_("LaTeX"), - classref=LaTeXDoc, - table=1, - paper=1, - style=0, - ext=".tex" - ) +print_label = None +try: + mprog = Mime.get_application(_apptype) + + if Utils.search_for(mprog[0]): + print_label = _("Open in %(program_name)s") % { 'program_name': + mprog[1]} + else: + print_label = None +except: + print_label = None + +register_text_doc(_('LaTex'), LaTeXDoc, 1, 1, 0, ".tex", print_label) diff --git a/src/docgen/ODFDoc.py b/src/docgen/ODFDoc.py index 6d79af21d..5c45f42f1 100644 --- a/src/docgen/ODFDoc.py +++ b/src/docgen/ODFDoc.py @@ -56,7 +56,6 @@ import Errors # #------------------------------------------------------------------------- from gettext import gettext as _ -from xml.sax.saxutils import escape _apptype = 'application/vnd.oasis.opendocument.text'