~ubuntu-branches/ubuntu/trusty/python-enable/trusty

« back to all changes in this revision

Viewing changes to enthought/enable/example_support.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2010-02-28 14:56:36 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100228145636-9ghfhe3uy37tt3q6
Tags: 3.3.0-1
* New upstream release
* Bump Standards-Version to 3.8.4
* Switch to source format 3.0
* Update patches/freetype2.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# Force the selection of a valid toolkit.
12
12
#import enthought.enable.toolkit 
13
13
if not ETSConfig.enable_toolkit:
14
 
    for toolkit, toolkit_module in (('wx', 'wx'), ('qt4', 'PyQt4')):
 
14
    if ETSConfig.toolkit:
 
15
        # Set the enable_toolkit to the same value as the GUI toolkit
15
16
        try:
16
 
            exec "import " + toolkit_module
17
 
            ETSConfig.enable_toolkit = toolkit
18
 
            break
19
 
        except ImportError:
20
 
            pass
 
17
            exec "import enthought.enable.%s_backend" % ETSConfig.toolkit
 
18
            ETSConfig.enable_toolkit = ETSConfig.toolkit
 
19
        except (ImportError, SyntaxError):
 
20
            raise RuntimeError("Can't determine appropriate Enable backend for ETS toolkit '%s'; "
 
21
                 "Please set $ENABLE_TOOLKIT or ETSConfig.enable_toolkit." % ETSConfig.toolkit)
21
22
    else:
22
 
        raise RuntimeError("Can't load wx or qt4 backend for Chaco.")
 
23
        for toolkit, toolkit_module in (('wx', 'wx'), ('qt4', 'PyQt4')):
 
24
            try:
 
25
                exec "import " + toolkit_module
 
26
                ETSConfig.enable_toolkit = toolkit
 
27
                break
 
28
            except ImportError:
 
29
                pass
 
30
        else:
 
31
            raise RuntimeError("Can't load wx or qt4 backend for Chaco.")
23
32
 
24
33
 
25
34
if ETSConfig.enable_toolkit == 'wx':