-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure qasync/pyqtgraph rely on the same qt version
- Loading branch information
Showing
18 changed files
with
74 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
|
||
__all__ = ["USE_PYQT6", "QtCore", "QtWidgets", "QtGui", "pg", "qasync"] | ||
|
||
USE_PYQT6 = False | ||
try: | ||
import PyQt6.QtCore as QtCore | ||
import PyQt6.QtWidgets as QtWidgets | ||
import PyQt6.QtGui as QtGui | ||
|
||
USE_PYQT6 = True | ||
except (ImportError, ModuleNotFoundError): | ||
import PyQt5.QtCore as QtCore | ||
import PyQt5.QtWidgets as QtWidgets | ||
import PyQt5.QtGui as QtGui | ||
|
||
# import qasync once pyQt is imported so the correct version is used (it starts with PyQt5 then tries PyQt6) | ||
import qasync # noqa | ||
|
||
# make sure the version is correct in case the underlying code for qasync changed | ||
if USE_PYQT6 and qasync.QtModuleName != "PyQt6": | ||
raise AssertionError( | ||
f"Wrong version of PyQt6 used for qasync: {qasync.QtModuleName}" | ||
) | ||
elif not USE_PYQT6 and qasync.QtModuleName != "PyQt5": | ||
raise AssertionError( | ||
f"Wrong version of PyQt5 used for qasync: {qasync.QtModuleName}" | ||
) | ||
|
||
# pyqtgraph will check/try to import PyQT6 on load and might fail if some packages were imported | ||
# (if pyQt6 is halfway installed): so we force the version here | ||
os.environ.setdefault("PYQTGRAPH_QT_LIB", qasync.QtModuleName) | ||
|
||
# make sure pyqtgraph it imported from here so PYQTGRAPH_QT_LIB will always be set | ||
import pyqtgraph as pg # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.