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
5 changes: 4 additions & 1 deletion package/PartSeg/common_gui/napari_image_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ def toggle_points_visibility(self):
def toggle_scale_bar(self):
if _napari_le_7_0:
self.viewer.scale_bar.unit = "nm"
self.viewer.scale_bar.visible = not self.viewer.scale_bar.visible
if _napari_gt_8_0:
self.viewer.canvas.overlays.scale_bar.visible = not self.viewer.canvas.overlays.scale_bar.visible
else:
self.viewer.scale_bar.visible = not self.viewer.scale_bar.visible

def _dim_order_menu(self, point: QPoint):
menu = QMenu()
Expand Down
16 changes: 14 additions & 2 deletions package/tests/test_PartSeg/test_channel_control.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# pylint: disable=no-self-use

from pathlib import Path
from unittest.mock import MagicMock

import numpy as np
import pytest
from napari.utils.colormaps import make_colorbar
from pytestqt.qtbot import QtBot
from qtpy.QtCore import QPoint, Qt
from qtpy.QtGui import QImage

Expand Down Expand Up @@ -294,12 +296,21 @@ def check_parameters(name, index):

@pytest.mark.windows_ci_skip
@pytest.mark.parametrize("filter_value", NoiseFilterType.__members__.values())
def test_image_view_integration_filter(self, qtbot, tmp_path, filter_value, ch_property, image_view):
def test_image_view_integration_filter(
self,
qtbot: QtBot,
tmp_path: Path,
filter_value: NoiseFilterType,
ch_property: ChannelProperty,
image_view: ImageView,
):
image_view.channel_control.set_active(1)

def check_parameters(name, index):
def check_parameters(name: str, index: int):
return name == "test" and index == 1

image_view.show()

if filter_value is NoiseFilterType.No:
with (
qtbot.waitSignal(image_view.channel_control.coloring_update),
Expand All @@ -315,6 +326,7 @@ def check_parameters(name, index):
assert (filter_value != NoiseFilterType.No and np.any(image4 != 255)) or (
filter_value == NoiseFilterType.No and np.any(image4 == 255)
)
image_view.hide()

@pytest.mark.windows_ci_skip
def test_image_view_integration(self, qtbot, tmp_path, ch_property, image_view):
Expand Down
Loading