Beter handling of LaTeX in feature window

This commit is contained in:
Julien Pivotto 2007-07-20 00:05:38 +00:00
parent 4071d313c2
commit ddd7c13e16
1 changed files with 18 additions and 9 deletions

View File

@ -87,7 +87,7 @@ class FeaturesWindow:
_('Requires compilation of the idle module from Gajim sources.')), _('Requires compilation of the idle module from Gajim sources.')),
_('LaTeX'): (self.latex_available, _('LaTeX'): (self.latex_available,
_('Transform LaTeX espressions between $$ $$.'), _('Transform LaTeX espressions between $$ $$.'),
_('Requires latex, dvips and imagemagick. You have to set \'use_latex\' to True in the Advanced Configuration Editor.'), _('Requires texlive-latex-base, dvips and imagemagick. You have to set \'use_latex\' to True in the Advanced Configuration Editor.'),
_('Feature not available under Windows.')), _('Feature not available under Windows.')),
} }
@ -244,17 +244,26 @@ class FeaturesWindow:
file.write(texstr) file.write(texstr)
file.flush() file.flush()
file.close() file.close()
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'], try:
cwd=gettempdir()) p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
exitcode = p.wait()
if exitcode == 0:
p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
cwd=gettempdir()) cwd=gettempdir())
exitcode = p.wait() exitcode = p.wait()
except:
exitcode = 1
if exitcode == 0: if exitcode == 0:
p = Popen(['convert', tmpfile + '.ps', tmpfile + '.png'], try:
cwd=gettempdir()) p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
exitcode = p.wait() cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
if exitcode == 0:
try:
p = Popen(['convert', tmpfile + '.ps', tmpfile + '.png'],
cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
extensions = [".tex", ".log", ".aux", ".dvi", ".ps", ".png"] extensions = [".tex", ".log", ".aux", ".dvi", ".ps", ".png"]
for ext in extensions: for ext in extensions:
try: try: