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.')),
_('LaTeX'): (self.latex_available,
_('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.')),
}
@ -244,17 +244,26 @@ class FeaturesWindow:
file.write(texstr)
file.flush()
file.close()
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
cwd=gettempdir())
exitcode = p.wait()
if exitcode == 0:
p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
try:
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
if exitcode == 0:
p = Popen(['convert', tmpfile + '.ps', tmpfile + '.png'],
cwd=gettempdir())
exitcode = p.wait()
try:
p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
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"]
for ext in extensions:
try: