"""Convenience to import Qt if it is availible, otherwise provide stubs.

Normally I wouldn't bother with something like this, but due to the
testing contexts that we often run we may import stuff from uitools that
does not have Qt avilaible.

"""

__all__ = ['Qt', 'QtCore', 'QtGui']

try:
    from PyQt4 import QtCore, QtGui
except ImportError:
    try:
        from PySide import QtCore, QtGui
    except ImportError:
        for name in __all__:
            globals().setdefault(name, None)


Qt = QtCore.Qt if QtCore else None

"""Wrapping the differences between PyQt4 and PySide."""

import sys

__all__ = ['Qt', 'QtCore', 'QtGui']

try:
    import PySide
    from PySide import QtCore, QtGui
    sys.modules.setdefault('PyQt4', PySide)
except ImportError:
    try:
        import PyQt4
        from PyQt4 import QtCore, QtGui
        sys.modules.setdefault('PySide', PySide)
    except ImportError:
        for name in __all__:
            globals().setdefault(name, None)


Qt = QtCore.Qt if QtCore else None

Check for PySide first, and proxy PyQt4 to it
Check for PySide first, and proxy PyQt4 to it

This allows our other tools, which are rather dumb,
to import the wrong one and generally continue to
work.