mxcubecore.utils.qt_import#

Description#

This module import all symbols from PyQt in one single module space

It also imports the matplotlib module and allow to check version compatibility between PyQt and matplotbil

This module, on importing, assigns the variables:

qt_imported = [True,False] qt_version_no = <list of integers> example: [4,8,1] qt_variant = [‘PyQt5’,’PyQt4’,’PySide’]

mpl_imported = [True,False] mpl_version = <String as provided by matplotlib module> mpl_version_no = <list of integers> example: [1,4,0]

Usage#

This module could be imported directly instead of importing PyQt. But the original submodules in PyQt will be flattened.

For example:

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *

could be all replaced by:

from qt_import import *

Or you could directly import things in this way:

import qt_import as Qt
app = Qt.QApplication([])
But import lines like::

from qt_import import Qtcore

would fail (submodules are flattened)

To check the modules you are importing you can directly use this module to print out a report:

user@host: python qt_import.py
Using PyQt:  PyQt4, version: 4.8.6
Matplotlib:  PyQt4, version: 1.3.1
Matplotlib is COMPATIBLE with PyQt

Credits#

Inspired from code from “splot” (http://certif.com) splot is licensed under LGPL license

Functions

load_ui_file(filename)