Skip to content

Commit

Permalink
Fixed an issue with pyqtgraph as an optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Aug 25, 2022
1 parent b23d5b5 commit 621fff2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions skued/io/diffshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@
WITH_PYQTGRAPH = True


# This is weird, but PyQtGraph is an optional dependency
# Therefore, we cannot define this class unless PyQtGraph is importable
if hasattr(pg, "QtWidgets"):
BASE_CLASS = pg.QtWidgets
elif hasattr(pg, "QtGui"):
BASE_CLASS = pg.QtGui
else:
WITH_PYQTGRAPH = False
print("pyqtgraph not configure correctly, skipping import of `diffshow`.")
if WITH_PYQTGRAPH:

# This is weird, but PyQtGraph is an optional dependency
# Therefore, we cannot define this class unless PyQtGraph is importable
if hasattr(pg, "QtWidgets"):
BASE_CLASS = pg.QtWidgets
elif hasattr(pg, "QtGui"):
BASE_CLASS = pg.QtGui

class Diffshow(BASE_CLASS.QWidget):
"""
Widget containing a main viewer, plus some cursor information.
Expand Down

0 comments on commit 621fff2

Please sign in to comment.