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

[WIP] add camera spline widget #159

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions napari_animation/_qt/animation_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
QWidget,
)

from napari_animation.animation import Animation

from ..animation import Animation
from .camera_spline_widget import CameraSplineWidget
from .frame_widget import FrameWidget
from .keyframelistcontrol_widget import KeyFrameListControlWidget
from .keyframeslist_widget import KeyFramesListWidget
Expand Down Expand Up @@ -54,13 +54,18 @@ def __init__(self, viewer: Viewer, parent=None):
self.animationSlider.setToolTip("Scroll through animation")
self.animationSlider.setRange(0, len(self.animation._frames) - 1)

self.camera_spline_widget = CameraSplineWidget(
viewer=viewer, parent=self
)

# Create layout
self.setLayout(QVBoxLayout())
self.layout().addWidget(self.keyframesListControlWidget)
self.layout().addWidget(self.keyframesListWidget)
self.layout().addWidget(self.frameWidget)
self.layout().addWidget(self.saveButton)
self.layout().addWidget(self.animationSlider)
self.layout().addWidget(self.camera_spline_widget)

# establish key bindings and callbacks
self._add_keybind_callbacks()
Expand Down
26 changes: 26 additions & 0 deletions napari_animation/_qt/camera_spline_widget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from napari import Viewer
from napari_threedee.visualization import QtCameraSpline
from qtpy.QtWidgets import QVBoxLayout, QWidget
from superqt import QCollapsible


class CameraSplineWidget(QWidget):
"""Wrap the QtCameraSpline widget in a collapsible frame."""

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

self.spline_widget = QtCameraSpline(viewer=viewer)

self.collapsible_widget = QCollapsible("camera spline path")
self.collapsible_widget.addWidget(self.spline_widget)
self.collapsible_widget.toggled.connect(self._on_expand_or_collapse)

self.setLayout(QVBoxLayout())
self.layout().addWidget(self.collapsible_widget)

def _on_expand_or_collapse(self, event=None):
"""Make sure the spline widget is deactivated whenever the
collapsible is toggled.
"""
self.spline_widget.deactivate()
19 changes: 10 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ packages = find:
python_requires = >=3.8
include_package_data = True
install_requires =
imageio
imageio-ffmpeg
napari
npe2
numpy
qtpy
scipy
tqdm>=4.56.0
superqt
imageio
imageio-ffmpeg
napari
napari-threedee>=0.0.4
npe2
numpy
qtpy
scipy
tqdm>=4.56.0
superqt>=0.4.1


[options.extras_require]
Expand Down
Loading