aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/__init__.py.in
blob: a5b540cad0c6b32772cb076af9f50a8807d7f7e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript']
__version__         = "@BINDING_API_VERSION_FULL@"
__version_info__    = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@)


def _setupQtDirectories():
    import sys
    import os

    pysideDir = os.path.abspath(os.path.dirname(__file__))

    # On Windows add the PySide\openssl folder (if it exists) to the
    # PATH so the SSL DLLs can be found when Qt tries to dynamically
    # load them.  Tell Qt to load them and then reset the PATH.
    if sys.platform == 'win32':
        opensslDir = os.path.join(pysideDir, 'openssl')
        if os.path.exists(opensslDir):
            path = os.environ['PATH']
            try:
                os.environ['PATH'] = opensslDir + os.pathsep + path
                from . import QtNetwork
                QtNetwork.QSslSocket.supportsSsl()
            finally:
                os.environ['PATH'] = path

    # Tell Qt to look for plugins in the PySide package, if the
    # plugins folder exists there, instead of just the default of
    # looking only in Qt's install or build folder.
    from . import QtCore
    pluginsDir = os.path.join(pysideDir, 'plugins')
    if os.path.exists(pluginsDir) and \
           pluginsDir not in QtCore.QCoreApplication.libraryPaths():
        QtCore.QCoreApplication.addLibraryPath(pluginsDir)


_setupQtDirectories()