Skip to content

Commit

Permalink
Merge pull request #760 from mrariden/qtpy_refactor
Browse files Browse the repository at this point in the history
Qtpy refactor
  • Loading branch information
carsen-stringer authored Aug 22, 2023
2 parents be14e5f + 17a57fc commit fa29d9e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 18 deletions.
5 changes: 2 additions & 3 deletions cellpose/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 4 additions & 5 deletions cellpose/gui/guiparts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__()
Expand Down
4 changes: 2 additions & 2 deletions cellpose/gui/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cellpose/gui/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cellpose/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

gui_deps = [
'pyqtgraph>=0.11.0rc0',
'pyqt5',
'pyqt5.sip',
"pyqt6",
"pyqt6.sip",
'qtpy',
'superqt',
'google-cloud-storage'
]
Expand All @@ -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()

Expand Down

0 comments on commit fa29d9e

Please sign in to comment.