Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scroll bar to the main widget #68

Merged
merged 1 commit into from
Jan 3, 2025
Merged
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
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
Loading