Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jupyter = [
"jupyter_rfb >=0.3.3",
"glfw >=2.4",
]
pyqt = ["pyqt6 >=6.7", "qtpy >=2", "superqt[iconify] >=0.7.2"]
pyqt = ["pyqt6 >=6.7", "qtpy >=2", "superqt[iconify] >=0.8.1"]
pyside = [
# defer to superqt's pyside6 restrictions
"superqt[iconify,pyside6] >=0.8.0",
"superqt[iconify,pyside6] >=0.8.1",
# note: still may need to fix windows https://github.com/pyapp-kit/ndv/issues/59
"pyside6 >=6.7",
"qtpy >=2",
Expand Down
35 changes: 4 additions & 31 deletions src/ndv/views/_qt/_array_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,6 @@
"""


class _CmapCombo(QColormapComboBox):
def __init__(self, parent: QWidget | None = None) -> None:
super().__init__(parent, allow_user_colormaps=True, add_colormap_text="Add...")
self.setMinimumSize(140, 21)
# self.setStyleSheet("background-color: transparent;")

def showPopup(self) -> None:
super().showPopup()
popup = self.findChild(QFrame)
popup.setMinimumWidth(self.width() + 100)
popup.move(popup.x(), popup.y() - self.height() - popup.height())

# TODO: upstream me
def setCurrentColormap(self, color: cmap.Colormap) -> None:
"""Adds the color to the QComboBox and selects it."""
idx = 0
for idx in range(self.count()):
if item := self.itemColormap(idx):
if item.name == color.name:
# cmap_ is already here - just select it
self.setCurrentIndex(idx)
return

# cmap_ not in the combo box - add it!
self.addColormap(color)
# then, select it!
# NB: "Add..." was at idx, now it's at idx+1 and cmap_ is at idx
self.setCurrentIndex(idx)


class _QSpinner(QLabel):
SPIN_GIF = str(Path(__file__).parent.parent / "_resources" / "spin.gif")

Expand Down Expand Up @@ -217,7 +187,10 @@ def __init__(
# -- WIDGETS -- #
self.visible = QCheckBox()

self.cmap = _CmapCombo()
self.cmap = QColormapComboBox(
allow_user_colormaps=True, add_colormap_text="Add..."
)
self.cmap.setMinimumWidth(140)
self.cmap.setFocusPolicy(Qt.FocusPolicy.NoFocus)
self.cmap.addColormaps(default_luts)

Expand Down
Loading