Exemple #1
0
def load_pyqt4():
    global QT_MODULE_NAME, is_pyqt46, __version_info__
    logging.getLogger(__name__).debug('trying PyQt4')
    import PyQt4
    os.environ[QT_API] = PYQT4_API[0]
    setup_apiv2()
    logging.getLogger(__name__).debug('imported PyQt4')
    __version_info__ = tuple(__version__.split('.') + ['final', 1])
    is_pyqt46 = __version__.startswith('4.6')
    QT_MODULE_NAME = 'PyQt4'
    print PyQt_license_warning
Exemple #2
0
            pass

        from PyQt4.QtCore import PYQT_VERSION_STR as __version__  # analysis:ignore
    except ImportError:
        # Trying PyQt5 before switching to PySide (at this point, PyQt4 may
        # not be installed but PyQt5 or Pyside could still be if the QT_API
        # environment variable hasn't been set-up)
        try:
            import PyQt5  # analysis:ignore
            API = os.environ['QT_API'] = 'pyqt5'
            API_NAME = 'PyQt5'
        except ImportError:
            API = os.environ['QT_API'] = 'pyside'
            API_NAME = 'PySide'
    else:
        is_old_pyqt = __version__.startswith(('4.4', '4.5', '4.6', '4.7'))
        is_pyqt46 = __version__.startswith('4.6')
        import sip
        try:
            API_NAME += (" (API v%d)" % sip.getapi('QString'))
        except AttributeError:
            pass
        from PyQt4 import uic  # analysis:ignore

PYQT5 = False
if API == 'pyqt5':
    try:
        from PyQt5.QtCore import PYQT_VERSION_STR as __version__
        from PyQt5 import uic  # analysis:ignore
        PYQT5 = True
        is_old_pyqt = is_pyqt46 = False
Exemple #3
0
#    try:
#        sip.setapi('QString', 2)
#        sip.setapi('QVariant', 2)
#    except AttributeError:
#        # PyQt < v4.6: in future version, we should warn the user 
#        # that PyQt is outdated and won't be supported by Spyder >v2.1
#        pass
    try:
        from PyQt4.QtCore import PYQT_VERSION_STR as __version__
    except ImportError:
        # Switching to PySide
        API = os.environ['QT_API'] = 'pyside'
        API_NAME = 'PySide'
    else:
        __version_info__ = tuple(__version__.split('.')+['final', 1])
        is_old_pyqt = __version__.startswith(('4.4', '4.5', '4.6', '4.7'))
        is_pyqt46 = __version__.startswith('4.6')
        import sip
        try:
            API_NAME += (" (API v%d)" % sip.getapi('QString'))
        except AttributeError:
            pass

if API == 'pyside':
    try:
        from PySide import __version__  # analysis:ignore
    except ImportError:
        raise ImportError("Spyder requires PySide or PyQt to be installed")
    else:
        is_old_pyqt = is_pyqt46 = False
Exemple #4
0
 def closeEvent(self, event):
     super(FigureWindow, self).closeEvent(event)
     if PYQT_VERSION_STR.startswith('4.6'):
         self.emit(SIGNAL('destroyed()'))
Exemple #5
0
#    try:
#        import sip
#        sip.setapi('QString', 2)
#        sip.setapi('QVariant', 2)
#    except AttributeError:
#        warnings.warn("PyQt version is < v4.6\n"
#                      "We try to keep guidata compatible with PyQt >=4.4, "
#                      "so please report any compatibility issue.",
#                      PendingDeprecationWarning, stacklevel=2)
#    except ValueError, error:
#        warnings.warn("PyQt has been set to API#1\n"
#                      "Note that, even if guidata is designed for API#2, "
#                      "we try to keep it compatible with API#1, "
#                      "so please report any compatibility issue.",
#                      PendingDeprecationWarning, stacklevel=2)
    try:
        from PyQt4.QtCore import PYQT_VERSION_STR as __version__
        __version_info__ = tuple(__version__.split('.')+['final', 1])
        is_pyqt46 = __version__.startswith('4.6')
    except ImportError:
        # Switching to PySide
        os.environ['QT_API'] = _modname = 'pyside'

if _modname == 'pyside':
    warnings.warn("guidata is still not fully compatible with PySide",
                  RuntimeWarning)
    import PySide
    __version__ = PySide.__version__
    from PySide import *
    is_pyqt46 = False
Exemple #6
0
 def closeEvent(self, event):
     super(QsciEditor, self).closeEvent(event)
     if PYQT_VERSION_STR.startswith('4.6'):
         self.emit(SIGNAL('destroyed()'))