diff --git a/cellpose/gui/gui.py b/cellpose/gui/gui.py index 5a136de7..b9756351 100644 --- a/cellpose/gui/gui.py +++ b/cellpose/gui/gui.py @@ -7,11 +7,10 @@ from natsort import natsorted from tqdm import tqdm, trange -import PyQt5 -from PyQt5 import QtGui, QtCore, Qt, QtWidgets +from qtpy import QtGui, QtCore, QtWidgets from superqt import QRangeSlider from qtpy.QtCore import Qt as Qtp -from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QScrollBar, QSlider, QComboBox, QGridLayout, QPushButton, QFrame, QCheckBox, QLabel, QProgressBar, QLineEdit, QMessageBox, QGroupBox +from qtpy.QtWidgets import QMainWindow, QApplication, QWidget, QScrollBar, QSlider, QComboBox, QGridLayout, QPushButton, QFrame, QCheckBox, QLabel, QProgressBar, QLineEdit, QMessageBox, QGroupBox import pyqtgraph as pg from pyqtgraph import GraphicsScene diff --git a/cellpose/gui/guiparts.py b/cellpose/gui/guiparts.py index 8f2c3918..661eefc8 100644 --- a/cellpose/gui/guiparts.py +++ b/cellpose/gui/guiparts.py @@ -2,10 +2,9 @@ Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ -import PyQt5 -from PyQt5 import QtGui, QtCore, QtWidgets -from PyQt5.QtGui import QPainter, QPixmap -from PyQt5.QtWidgets import QApplication, QRadioButton, QWidget, QDialog, QButtonGroup, QSlider, QStyle, QStyleOptionSlider, QGridLayout, QPushButton, QLabel, QLineEdit, QDialogButtonBox, QComboBox, QCheckBox +from qtpy import QtGui, QtCore, QtWidgets +from qtpy.QtGui import QPainter, QPixmap +from qtpy.QtWidgets import QApplication, QRadioButton, QWidget, QDialog, QButtonGroup, QSlider, QStyle, QStyleOptionSlider, QGridLayout, QPushButton, QLabel, QLineEdit, QDialogButtonBox, QComboBox, QCheckBox import pyqtgraph as pg from pyqtgraph import functions as fn from pyqtgraph import Point @@ -509,7 +508,7 @@ class ImageDraw(pg.ImageItem): for controlling the levels and lookup table used to display the image. """ - sigImageChanged = QtCore.pyqtSignal() + sigImageChanged = QtCore.Signal() def __init__(self, image=None, viewbox=None, parent=None, **kargs): super(ImageDraw, self).__init__() diff --git a/cellpose/gui/io.py b/cellpose/gui/io.py index 6703b1a9..7c949a56 100644 --- a/cellpose/gui/io.py +++ b/cellpose/gui/io.py @@ -15,8 +15,8 @@ from ..transforms import normalize99 try: - import PyQt5 - from PyQt5.QtWidgets import QFileDialog + import qtpy + from qtpy.QtWidgets import QFileDialog GUI = True except: GUI = False diff --git a/cellpose/gui/menus.py b/cellpose/gui/menus.py index d0793d32..3d708bbb 100644 --- a/cellpose/gui/menus.py +++ b/cellpose/gui/menus.py @@ -2,8 +2,8 @@ Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ -import PyQt5 -from PyQt5.QtWidgets import QAction +import qtpy +from qtpy.QtWidgets import QAction from . import io from .. import models from ..io import save_server diff --git a/cellpose/io.py b/cellpose/io.py index f0d0b6ac..073877ef 100644 --- a/cellpose/io.py +++ b/cellpose/io.py @@ -15,8 +15,8 @@ try: - from PyQt5 import QtGui, QtCore, Qt, QtWidgets - from PyQt5.QtWidgets import QMessageBox + from qtpy import QtGui, QtCore, Qt, QtWidgets + from qtpy.QtWidgets import QMessageBox GUI = True except: GUI = False diff --git a/environment.yml b/environment.yml index 11a23a09..5413f04a 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,8 @@ dependencies: - python==3.8.5 - pip - pip: - - PyQt5 - - PyQt5.sip + - qtpy +# - PyQt5.sip - numpy>=1.20.0 - numba>=0.43.1 - scipy diff --git a/setup.py b/setup.py index 694c901c..131b6d26 100644 --- a/setup.py +++ b/setup.py @@ -14,8 +14,9 @@ gui_deps = [ 'pyqtgraph>=0.11.0rc0', - 'pyqt5', - 'pyqt5.sip', + "pyqt6", + "pyqt6.sip", + 'qtpy', 'superqt', 'google-cloud-storage' ] @@ -42,6 +43,29 @@ except: pass +try: + import PyQt5 + gui_deps.remove("pyqt6") + gui_deps.remove("pyqt6.sip") + gui_deps.append("pyqt5") + gui_deps.append("pyqt5.sip") +except: + pass + +try: + import PySide2 + gui_deps.remove("pyqt6") + gui_deps.remove("pyqt6.sip") +except: + pass + +try: + import PySide6 + gui_deps.remove("pyqt6") + gui_deps.remove("pyqt6.sip") +except: + pass + with open("README.md", "r") as fh: long_description = fh.read()