Skip to content

Commit

Permalink
rename widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
niksirbi committed Feb 28, 2024
1 parent 98a2d08 commit 4c90095
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
19 changes: 0 additions & 19 deletions movement/napari/_widget.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
logger = logging.getLogger(__name__)


class FileLoader(QWidget):
"""Widget for loading pose tracks from files into a napari viewer."""
class Loader(QWidget):
"""Widget for loading data from files."""

file_suffix_map = {
"DeepLabCut": "Files containing predicted poses (*.h5 *.csv)",
Expand Down
24 changes: 24 additions & 0 deletions movement/napari/meta_widget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from brainglobe_utils.qtpy.collapsible_widget import CollapsibleWidgetContainer
from napari.viewer import Viewer

from movement.napari.loader_widget import Loader


class MovementMetaWidget(CollapsibleWidgetContainer):
"""The widget to rule all movement napari widgets.
This is a container of collapsible widgets, each responsible
for handing specific tasks in the movement napari workflow.
"""

def __init__(self, napari_viewer: Viewer, parent=None):
super().__init__()

self.add_widget(
Loader(napari_viewer, parent=self),
collapsible=True,
widget_title="Load",
)

self.loader = self.collapsible_widgets[0]
self.loader.expand() # expand the loader widget by default
2 changes: 1 addition & 1 deletion movement/napari/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ display_name: movement
contributions:
commands:
- id: movement.make_widget
python_name: movement.napari._widget:MovementWidgets
python_name: movement.napari.meta_widget:MovementMetaWidget
title: movement
widgets:
- command: movement.make_widget
Expand Down
8 changes: 4 additions & 4 deletions tests/test_integration/test_napari_widgets.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest

from movement.napari._widget import MovementWidgets
from movement.napari.meta_widget import MovementMetaWidget


@pytest.fixture
def movement_widget(make_napari_viewer) -> MovementWidgets:
"""Fixture to expose the MovementWidgets to the tests.
def movement_meta_widget(make_napari_viewer) -> MovementMetaWidget:
"""Fixture to expose the MovementMetaWidget for testing.
Simultaneously acts as a smoke test that the widget
can be instantiated without crashing."""
viewer = make_napari_viewer()
return MovementWidgets(viewer)
return MovementMetaWidget(viewer)

0 comments on commit 4c90095

Please sign in to comment.