Skip to content

Commit

Permalink
Make BadDataOverlay mixin an abstract base class
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc committed Nov 14, 2024
1 parent 897a8ed commit 9670f79
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mantidimaging/gui/widgets/bad_data_overlay/bad_data_overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
# SPDX - License - Identifier: GPL-3.0-or-later
from __future__ import annotations

from abc import abstractmethod, ABC
from collections.abc import Callable

import numpy as np
from pyqtgraph import ColorMap, ImageItem, ViewBox

from mantidimaging.gui.utility.qt_helpers import _metaclass_sip_abc
from mantidimaging.gui.widgets.indicator_icon.view import IndicatorIconView
from mantidimaging.core.utility import finder

Expand Down Expand Up @@ -54,7 +56,7 @@ def clear(self) -> None:
self.overlay.clear()


class BadDataOverlay:
class BadDataOverlay(ABC, metaclass=_metaclass_sip_abc):
"""
Mixin class to be used with MIImageView and MIMiniImageView
"""
Expand All @@ -69,12 +71,14 @@ def __init__(self) -> None:
self.sigTimeChanged.connect(self.check_for_bad_data)

@property
@abstractmethod
def image_item(self) -> ImageItem:
raise NotImplementedError
...

@property
@abstractmethod
def viewbox(self) -> ViewBox:
raise NotImplementedError
...

def enable_nan_check(self, enable: bool = True, actions: list[tuple[str, Callable]] | None = None) -> None:
if enable:
Expand Down

0 comments on commit 9670f79

Please sign in to comment.