259
255
return sleepy.SUPPORTED
261
257
def latex_available(self):
262
'''check is latex is available and if it can create a picture.'''
266
tmpfile = os.path.join(gettempdir(), "gajimtex_" + \
267
random.randint(0,100).__str__())
270
texstr = '\\documentclass[12pt]{article}\\usepackage[dvips]{graphicx}'
271
texstr += '\\usepackage{amsmath}\\usepackage{amssymb}\\pagestyle{empty}'
272
texstr += '\\begin{document}\\begin{large}\\begin{gather*}test'
273
texstr += '\\end{gather*}\\end{large}\\end{document}'
275
file = open(os.path.join(tmpfile + ".tex"), "w+")
282
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
283
creationflags=0x08000000, cwd=gettempdir())
285
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
294
p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
295
tmpfile + '.dvi', '-o', tmpfile + '.png'],
296
creationflags=0x08000000, cwd=gettempdir())
298
p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
299
tmpfile + '.dvi', '-o', tmpfile + '.png'], cwd=gettempdir())
303
extensions = ['.tex', '.log', '.aux', '.dvi', '.png']
304
for ext in extensions:
306
os.remove(tmpfile + ext)
258
return gajim.HAVE_LATEX
313
260
def pycrypto_available(self):
314
261
from common import gajim