Skip to content

Commit

Permalink
Add scroll bar
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov committed Jan 2, 2025
1 parent 6344010 commit 7d486d6
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions brainglobe_registration/registration_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from napari.utils.notifications import show_error
from napari.viewer import Viewer
from pytransform3d.rotations import active_matrix_from_angle
from qtpy.QtWidgets import QCheckBox, QPushButton, QTabWidget
from qtpy.QtWidgets import QCheckBox, QPushButton, QScrollArea, QTabWidget
from skimage.segmentation import find_boundaries
from skimage.transform import rescale

Expand All @@ -51,10 +51,11 @@
)


class RegistrationWidget(CollapsibleWidgetContainer):
class RegistrationWidget(QScrollArea):
def __init__(self, napari_viewer: Viewer):
super().__init__()
self.setContentsMargins(10, 10, 10, 10)
self.widget = CollapsibleWidgetContainer()
self.widget.setContentsMargins(10, 10, 10, 10)

self._viewer = napari_viewer
self._atlas: Optional[BrainGlobeAtlas] = None
Expand Down Expand Up @@ -149,19 +150,21 @@ def __init__(self, napari_viewer: Viewer):
self.run_button.clicked.connect(self._on_run_button_click)
self.run_button.setEnabled(False)

self.add_widget(
self.widget.add_widget(
header_widget(
"brainglobe-<br>registration", # line break at <br>
"Registration with Elastix",
github_repo_name="brainglobe-registration",
),
collapsible=False,
)
self.add_widget(self.get_atlas_widget, widget_title="Select Images")
self.add_widget(
self.widget.add_widget(
self.get_atlas_widget, widget_title="Select Images"
)
self.widget.add_widget(
self.adjust_moving_image_widget, widget_title="Prepare Images"
)
self.add_widget(
self.widget.add_widget(
self.transform_select_view, widget_title="Select Transformations"
)

Expand All @@ -177,18 +180,21 @@ def __init__(self, napari_viewer: Viewer):
self.parameters_tab.addTab(new_tab, transform_type)
self.parameter_setting_tabs_lists.append(new_tab)

self.add_widget(
self.widget.add_widget(
self.parameters_tab, widget_title="Advanced Settings (optional)"
)

self.add_widget(self.filter_checkbox, collapsible=False)
self.widget.add_widget(self.filter_checkbox, collapsible=False)

self.add_widget(self.run_button, collapsible=False)
self.widget.add_widget(self.run_button, collapsible=False)

self.layout().itemAt(1).widget().collapse(animate=False)
self.widget.layout().itemAt(1).widget().collapse(animate=False)

check_atlas_installed(self)

self.setWidgetResizable(True)
self.setWidget(self.widget)

def _connect_events(self):
@self._viewer.layers.events.removed.connect
def _on_layer_deleted(event: Event):
Expand Down

0 comments on commit 7d486d6

Please sign in to comment.