Skip to content

Commit

Permalink
WIP compatibility with brainglobe-utils-collapsible-widget 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Nov 17, 2023
1 parent d051dc4 commit ad5eb3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
7 changes: 4 additions & 3 deletions brainglobe_template_builder/napari/chest_of_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
class ChestOfDrawers(CollapsibleWidgetContainer):
def __init__(self, napari_viewer: Viewer, parent=None):
super().__init__()
self.add_widget(GenerateMask(napari_viewer, parent=self))
self.add_widget(GenerateMask(napari_viewer, parent=self))
mask_widget_1 = GenerateMask(napari_viewer, parent=self)
self.add_widget(mask_widget_1, collapsible=True, widget_title="Mask 1")

Check warning on line 12 in brainglobe_template_builder/napari/chest_of_widgets.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/chest_of_widgets.py#L11-L12

Added lines #L11 - L12 were not covered by tests

random_button = QPushButton("Random button", parent=self)
self.add_widget(random_button)

self.add_widget(GenerateMask(napari_viewer, parent=self))
mask_widget_2 = GenerateMask(napari_viewer, parent=self)
self.add_widget(mask_widget_2, collapsible=True, widget_title="Mask 2")

Check warning on line 18 in brainglobe_template_builder/napari/chest_of_widgets.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/chest_of_widgets.py#L17-L18

Added lines #L17 - L18 were not covered by tests
19 changes: 7 additions & 12 deletions brainglobe_template_builder/napari/mask_widget.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from brainglobe_utils.qtpy.collapsible_widget import CollapsibleWidget
from napari.layers import Image
from napari.utils.notifications import show_info
from napari.viewer import Viewer
Expand All @@ -18,32 +17,28 @@
)


class GenerateMask(CollapsibleWidget):
class GenerateMask(QWidget):

Check warning on line 20 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L20

Added line #L20 was not covered by tests
def __init__(self, napari_viewer: Viewer, parent=None):
super().__init__(title="Generate Mask", parent=parent)
super().__init__(parent=parent)

Check warning on line 22 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L22

Added line #L22 was not covered by tests
self.viewer = napari_viewer

content = QWidget(parent=self)
content.setLayout(QFormLayout())

self.setContent(content)
self.setLayout(QFormLayout())

Check warning on line 24 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L24

Added line #L24 was not covered by tests

self.gauss_sigma = QSpinBox(parent=self)
self.gauss_sigma.setRange(0, 20)
self.gauss_sigma.setValue(3)
content.layout().addRow("gauss sigma:", self.gauss_sigma)
self.layout().addRow("gauss sigma:", self.gauss_sigma)

Check warning on line 29 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L29

Added line #L29 was not covered by tests

self.threshold_method = QComboBox(parent=self)
self.threshold_method.addItems(["triangle", "otsu", "isodata"])
content.layout().addRow("threshold method:", self.threshold_method)
self.layout().addRow("threshold method:", self.threshold_method)

Check warning on line 33 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L33

Added line #L33 was not covered by tests

self.erosion_size = QSpinBox(parent=self)
self.erosion_size.setRange(0, 20)
self.erosion_size.setValue(5)
content.layout().addRow("erosion size:", self.erosion_size)
self.layout().addRow("erosion size:", self.erosion_size)

Check warning on line 38 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L38

Added line #L38 was not covered by tests

self.generate_mask_button = QPushButton("Generate mask", parent=self)
content.layout().addRow(self.generate_mask_button)
self.layout().addRow(self.generate_mask_button)

Check warning on line 41 in brainglobe_template_builder/napari/mask_widget.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_template_builder/napari/mask_widget.py#L41

Added line #L41 was not covered by tests
self.generate_mask_button.clicked.connect(self._on_button_click)

def _on_button_click(self):
Expand Down

0 comments on commit ad5eb3c

Please sign in to comment.