draperjames / qtpandas

Qt Meets Pandas
MIT License
140 stars 53 forks source link

PyQt4/PySide importing #34

Closed carmelom closed 7 years ago

carmelom commented 7 years ago

I'm using qtpandas as a module in a PySide project, so I want all the calls from the compat imports to be from PySide. I also have PyQt4 installed system-wide as well, but it is not going to be imported anywhere in the project. Unfortunately, following the default order, compat tries to import PyQt4 first, it finds it, so classes like QtGui are overwritten by the ones from PyQt4. This makes trouble when later I create objects that are, for instance, a subclass of QtGui.QWidget et similia. The easy patch for my case is to switch the try cases, but one is simply re-phrasing the problem in this way... There should be a way to look if one of the modules is already imported, like is done in pyqtgraph: https://github.com/pyqtgraph/pyqtgraph/blob/develop/pyqtgraph/Qt.py AFAIU, their Qt module should do the same job as the compat one...

carmelom commented 7 years ago

Sorry, this applies to the version I got from PyPI (1.0.3) i guess, but the latest master branch already relies on qtpy to solve the compatibility.