~jtaylor/ubuntu/oneiric/gajim/multiple-CVE

« back to all changes in this revision

Viewing changes to src/features_window.py

  • Committer: Bazaar Package Importer
  • Author(s): Nafallo Bjälevik
  • Date: 2009-06-12 13:49:19 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090612134919-basez34an73qkkb1
Tags: 0.12.2-0ubuntu1
* New upstream bugfix release:
  + Better keepalive / ping behaviour
  + Fix custom port handling
  + Improve error messages handling
  + Totem support for played music
  + Fix SSL with some servers
  + Handle XFCE notification-daemon
  + Restore old behaviour of click on systray: left click to open events
  + Network manager 0.7 support
  + Improve Kerberos support
  + Many bugfixes here and there
  + Add -c option to history_manager
* debian/patches/00list:
  - Disable de-update.patch, since it doesn't apply
  - Drop svn-11058.patch since it is included in the new release
* debian/patches/svn-11058.patch:
  - Drop patch since it is included in the new release
* debian/control:
  - Bump required version for intltool as per upstream's requirements

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from common import gajim
34
34
from common import helpers
35
35
 
36
 
import random
37
 
from tempfile import gettempdir
38
 
from subprocess import Popen
39
 
 
40
36
class FeaturesWindow:
41
37
        '''Class for features window'''
42
38
 
259
255
                return sleepy.SUPPORTED
260
256
 
261
257
        def latex_available(self):
262
 
                '''check is latex is available and if it can create a picture.'''
263
 
 
264
 
                exitcode = 0
265
 
                random.seed()
266
 
                tmpfile = os.path.join(gettempdir(), "gajimtex_" + \
267
 
                        random.randint(0,100).__str__())
268
 
 
269
 
                # build latex string
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}'
274
 
 
275
 
                file = open(os.path.join(tmpfile + ".tex"), "w+")
276
 
                file.write(texstr)
277
 
                file.flush()
278
 
                file.close()
279
 
                try:
280
 
                        if os.name == 'nt':
281
 
                                # CREATE_NO_WINDOW
282
 
                                p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
283
 
                                        creationflags=0x08000000, cwd=gettempdir())
284
 
                        else:
285
 
                                p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
286
 
                                        cwd=gettempdir())
287
 
                        exitcode = p.wait()
288
 
                except Exception:
289
 
                        exitcode = 1
290
 
                if exitcode == 0:
291
 
                        try:
292
 
                                if os.name == 'nt':
293
 
                                        # CREATE_NO_WINDOW
294
 
                                        p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
295
 
                                                tmpfile + '.dvi', '-o', tmpfile + '.png'],
296
 
                                                creationflags=0x08000000, cwd=gettempdir())
297
 
                                else:
298
 
                                        p = Popen(['dvipng', '-bg', 'white', '-T', 'tight',
299
 
                                                tmpfile + '.dvi', '-o', tmpfile + '.png'], cwd=gettempdir())
300
 
                                exitcode = p.wait()
301
 
                        except Exception:
302
 
                                exitcode = 1
303
 
                extensions = ['.tex', '.log', '.aux', '.dvi', '.png']
304
 
                for ext in extensions:
305
 
                        try:
306
 
                                os.remove(tmpfile + ext)
307
 
                        except Exception:
308
 
                                pass
309
 
                if exitcode == 0:
310
 
                        return True
311
 
                return False
 
258
                return gajim.HAVE_LATEX
312
259
 
313
260
        def pycrypto_available(self):
314
261
                from common import gajim