napari / napari-animation

A napari plugin for making animations
https://napari.github.io/napari-animation/
Other
76 stars 27 forks source link

Error when restarting napari-animation #122

Closed haesleinhuepf closed 2 years ago

haesleinhuepf commented 2 years ago

When starting the napari animation wizzard twice (and closing the widget after the first attempt): The error below shows up. One can continue using napari-animation only after restarting napari. It does not matter if the plugin is called from the Plugins or the Tools > Visualization menu.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari\_qt\menus\plugins_menu.py:97, in PluginsMenu._add_plugin_actions.._add_toggle_widget(key=('animation', 'Wizard'), hook_type='dock')
     94     return
     96 if hook_type == 'dock':
---> 97     dock_widget, _w = self._win.add_plugin_dock_widget(*key)
        key = ('animation', 'Wizard')
        self._win = 
        self = 
     98 else:
     99     dock_widget = self._win._add_plugin_function_widget(*key)

File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari\_qt\qt_main_window.py:685, in Window.add_plugin_dock_widget(self=, plugin_name='animation', widget_name='Wizard')
    682         wdg = wdg._magic_widget
    683     return dock_widget, wdg
--> 685 wdg = _instantiate_dock_widget(Widget, self._qt_viewer.viewer)
        Widget = 
        self = 
    687 # Add dock widget
    688 dock_kwargs.pop('name', None)

File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari\_qt\qt_main_window.py:1248, in _instantiate_dock_widget(wdg_cls=, viewer=Viewer(axes=Axes(visible=False, labels=True, col....AnimationWidget object at 0x000002199561BEE0>>}))
   1243             break
   1244         # cannot look for param.kind == param.VAR_KEYWORD because
   1245         # QWidget allows **kwargs but errs on unknown keyword arguments
   1246 
   1247 # instantiate the widget
-> 1248 return wdg_cls(**kwargs)
        kwargs = {'viewer': Viewer(axes=Axes(visible=False, labels=True, colored=True, dashed=False, arrows=True), camera=Camera(center=(0.0, 126.5, 127.5), zoom=3.938385826771653, angles=(0.0, 0.0, 90.0), perspective=0.0, interactive=True), cursor=Cursor(position=(238.8556815945384, 280.862331114264), scaled=True, size=1, style=), dims=Dims(ndim=2, ndisplay=2, last_used=0, range=((0.0, 254.0, 1.0), (0.0, 256.0, 1.0)), current_step=(127, 128), order=(0, 1), axis_labels=('0', '1')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], scale_bar=ScaleBar(visible=False, colored=False, ticks=True, position=, font_size=10, unit=None), text_overlay=TextOverlay(visible=False, color=(0.5, 0.5, 0.5, 1.0), font_size=10, position=, text=''), overlays=Overlays(interaction_box=InteractionBox(points=None, show=False, show_handle=False, show_vertices=False, selection_box_drag=None, selection_box_final=None, transform_start=, transform_drag=, transform_final=, transform=, allow_new_selection=True, selected_vertex=None)), help='', status='blobs [239 281]', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_move_callbacks=[.mouse_move at 0x00000219889969D0>], mouse_drag_callbacks=[.mouse_drag at 0x0000021988996790>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={'Shift': .hold_to_lock_aspect_ratio at 0x0000021988996670>, 'Control-Shift-R': , 'Control-Shift-A': , 'Alt-F': >, 'Alt-R': >, 'Alt-D': >, 'Alt-A': >, 'Alt-B': >})}
        wdg_cls = 

File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari_animation\_qt\animation_widget.py:47, in AnimationWidget.__init__(self=, viewer=Viewer(axes=Axes(visible=False, labels=True, col....AnimationWidget object at 0x000002199561BEE0>>}), parent=None)
     44 self._init_ui()
     46 # establish key bindings and callbacks
---> 47 self._add_keybind_callbacks()
        self = 
     48 self._add_callbacks()

File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari_animation\_qt\animation_widget.py:64, in AnimationWidget._add_keybind_callbacks(self=)
     61 def _add_keybind_callbacks(self):
     62     """Bind keys"""
---> 64     self.animation.viewer.bind_key(
        self.animation.viewer = Viewer(axes=Axes(visible=False, labels=True, colored=True, dashed=False, arrows=True), camera=Camera(center=(0.0, 126.5, 127.5), zoom=3.938385826771653, angles=(0.0, 0.0, 90.0), perspective=0.0, interactive=True), cursor=Cursor(position=(238.8556815945384, 280.862331114264), scaled=True, size=1, style=), dims=Dims(ndim=2, ndisplay=2, last_used=0, range=((0.0, 254.0, 1.0), (0.0, 256.0, 1.0)), current_step=(127, 128), order=(0, 1), axis_labels=('0', '1')), grid=GridCanvas(stride=1, shape=(-1, -1), enabled=False), layers=[], scale_bar=ScaleBar(visible=False, colored=False, ticks=True, position=, font_size=10, unit=None), text_overlay=TextOverlay(visible=False, color=(0.5, 0.5, 0.5, 1.0), font_size=10, position=, text=''), overlays=Overlays(interaction_box=InteractionBox(points=None, show=False, show_handle=False, show_vertices=False, selection_box_drag=None, selection_box_final=None, transform_start=, transform_drag=, transform_final=, transform=, allow_new_selection=True, selected_vertex=None)), help='', status='blobs [239 281]', tooltip=Tooltip(visible=False, text=''), theme='dark', title='napari', mouse_move_callbacks=[.mouse_move at 0x00000219889969D0>], mouse_drag_callbacks=[.mouse_drag at 0x0000021988996790>], mouse_double_click_callbacks=[], mouse_wheel_callbacks=[], _persisted_mouse_event={}, _mouse_drag_gen={}, _mouse_wheel_gen={}, keymap={'Shift': .hold_to_lock_aspect_ratio at 0x0000021988996670>, 'Control-Shift-R': , 'Control-Shift-A': , 'Alt-F': >, 'Alt-R': >, 'Alt-D': >, 'Alt-A': >, 'Alt-B': >})
        self = 
        self.animation = 
     65         "Alt-f", self._capture_keyframe_callback
     66     )
     67     self.animation.viewer.bind_key(
     68         "Alt-r", self._replace_keyframe_callback
     69     )
     70     self.animation.viewer.bind_key("Alt-d", self._delete_keyframe_callback)

File C:\ProgramData\Miniconda3\envs\devbio-napari-env\lib\site-packages\napari\utils\key_bindings.py:277, in bind_key(keymap={'Alt-A': >, 'Alt-B': >, 'Alt-D': >, 'Alt-F': >, 'Alt-R': >, 'Control-Shift-A': , 'Control-Shift-R': , 'Shift': .hold_to_lock_aspect_ratio>}, key='Alt-F', func=>, overwrite=False)
    274     key = normalize_key_combo(key)
    276 if func is not None and key in keymap and not overwrite:
--> 277     raise ValueError(
        trans = 
        key = 'Alt-F'
    278         trans._(
    279             'key combination {key} already used! specify \'overwrite=True\' to bypass this check',
    280             deferred=True,
    281             key=key,
    282         )
    283     )
    285 unbound = keymap.pop(key, None)
    287 if func is not None:

ValueError: key combination Alt-F already used! specify 'overwrite=True' to bypass this check

That's the corresponding napari-info. The installation is 1 day old:

napari: 0.4.15
Platform: Windows-10-10.0.17763-SP0
Python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:50:36) [MSC v.1929 64 bit (AMD64)]
Qt: 5.15.4
PyQt5: 5.15.7
NumPy: 1.22.4
SciPy: 1.9.0
Dask: 2022.8.0
VisPy: 0.9.6

OpenGL:
- GL version: 4.6.0 NVIDIA 516.01
- MAX_TEXTURE_SIZE: 32768

Screens:
- screen 1: resolution 1920x1200, scale 1.0

Plugins:
- PlatyMatch: 0.0.3
- RedLionfish: 0.5
- animation: 0.0.2
- clEsperanto: 0.18.3
- console: 0.0.4
- devbio_napari: 0.5.9
- napari-3d-ortho-viewer: 0.0.1
- napari-accelerated-pixel-and-object-classification: 0.8.2
- napari-assistant: 0.3.10
- napari-brightness-contrast: 0.1.7
- napari-clusters-plotter: 0.5.1
- napari-crop: 0.1.6
- napari-curtain: 0.1.1
- napari-folder-browser: 0.1.3
- napari-layer-details-display: 0.1.4
- napari-mouse-controls: 0.1.3
- napari-plot-profile: 0.2.1
- napari-plugin-search: 0.1.3
- napari-segment-blobs-and-things-with-membranes: 0.3.1
- napari-simpleitk-image-processing: 0.4.2
- napari-tabu: 0.1.5
- napari-time-slicer: 0.4.9
- napari-tools-menu: 0.1.16
- napari-workflow-inspector: 0.2.2
- napari-workflow-optimizer: 0.1.4
- napari_skimage_regionprops1: 0.5.3
- napari_skimage_regionprops2: 0.5.3
- scikit-image: 0.4.15
- svg: 0.1.6
- the-segmentation-game: 0.1.0
alisterburt commented 2 years ago

Oh, whoops! Thanks for the report Robert 🙂

alisterburt commented 2 years ago

closed by #124 - thanks @cormsby626 !