Skip to content
Open
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
additional_dependencies: [numpy>=1.23]
exclude: docs
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
additional_dependencies: [toml]
Expand Down Expand Up @@ -49,7 +49,7 @@ repos:
hooks:
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
rev: v0.15.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
24 changes: 8 additions & 16 deletions src/napari_spatialdata/_scatterwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,12 @@ def __init__(self, model: DataModel, color_data: dict[str, Any]):
color_button = ColorButton(color=color)
color_button.setMinimumSize(60, 30)
color_button.setMaximumSize(60, 30)
color_button.setStyleSheet(
"""
color_button.setStyleSheet("""
QPushButton {
background-color: transparent;
border: none;
}
"""
)
""")

self.color_buttons[obj_category] = color_button

Expand Down Expand Up @@ -384,17 +382,15 @@ def __init__(self, viewer: Viewer | None, model: DataModel) -> None:
self.drawing_mode_button = QPushButton(self)
self.drawing_mode_button.setIcon(QIcon(str(Path(__file__).parent / "resources/icons8-polygon-80.png")))
self.drawing_mode_button.setIconSize(QSize(24, 24))
self.drawing_mode_button.setStyleSheet(
f"""
self.drawing_mode_button.setStyleSheet(f"""
QPushButton {{
background-color: transparent;
border: none;
}}
QPushButton:checked {{
border: 1px solid rgb{self.color};
}}
"""
)
""")
self.drawing_mode_button.setCheckable(True)
self.drawing_mode_button.clicked.connect(self.toggle_drawing_mode)
self.drawing_mode_button.setToolTip("Add freehand ROIs.")
Expand All @@ -405,17 +401,15 @@ def __init__(self, viewer: Viewer | None, model: DataModel) -> None:
self.rectangle_mode_button = QPushButton(self)
self.rectangle_mode_button.setIcon(QIcon(str(Path(__file__).parent / "resources/icons8-rectangle-48.png")))
self.rectangle_mode_button.setIconSize(QSize(24, 24))
self.rectangle_mode_button.setStyleSheet(
f"""
self.rectangle_mode_button.setStyleSheet(f"""
QPushButton {{
background-color: transparent;
border: none;
}}
QPushButton:checked {{
border: 1px solid rgb{self.color};
}}
"""
)
""")
self.rectangle_mode_button.setCheckable(True)
self.rectangle_mode_button.clicked.connect(self.toggle_rectangle_mode)
self.rectangle_mode_button.setToolTip("Add rectangular ROIs.")
Expand Down Expand Up @@ -873,14 +867,12 @@ def wrap_discrete_color_widget(self) -> QtWidgets.QGraphicsProxyWidget:
# view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
# sets stle of the vertical slider
view.setStyleSheet(get_current_stylesheet())
view.setStyleSheet(
"""
view.setStyleSheet("""
QGraphicsView {
border: none;
background: rgb(0, 0, 0);
}
"""
)
""")

view.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)

Expand Down
3 changes: 2 additions & 1 deletion src/napari_spatialdata/_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
from vispy import scene
from vispy.color.colormap import Colormap, MatplotlibColormap
from vispy.scene.widgets import ColorBarWidget

# See https://github.com/scverse/squidpy/issues/1061 for more details.
# Scanpy 0.11.x-0.12.x renamed set_default_colors_for_categorical_obs to _set_default_colors_for_categorical_obs
# and then changed it back. Try underscore version first, fall back to non-underscore.
try:
from scanpy.plotting._utils import _set_default_colors_for_categorical_obs as set_default_colors_for_categorical_obs
except ImportError:
from scanpy.plotting._utils import set_default_colors_for_categorical_obs
pass

# See https://github.com/scverse/squidpy/issues/1061 for more details.
# Scanpy 0.11.x-0.12.x renamed set_default_colors_for_categorical_obs to _set_default_colors_for_categorical_obs
Expand Down
Loading