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

Error when closing and re-opening the plugin #22

Open
jo-mueller opened this issue Oct 20, 2023 · 0 comments · May be fixed by #23
Open

Error when closing and re-opening the plugin #22

jo-mueller opened this issue Oct 20, 2023 · 0 comments · May be fixed by #23

Comments

@jo-mueller
Copy link

Hi @JoOkuma ,

I'm getting an error when I open, close and re-open the plugin. The error is this:

        self = <Container ()>
     97 self._viewer.bind_key("X", self._cancel_annot)

File ~\Anaconda3\envs\pytorch\lib\site-packages\napari\utils\key_bindings.py:286, in bind_key(keymap={'C': <bound method SAMWidget._on_confirm_mask of <Container ()>>, 'X': <bound method SAMWidget._cancel_annot of <Container ()>>}, key='C', func=<bound method SAMWidget._on_confirm_mask of <Container ()>>, overwrite=False)
    283     key = normalize_key_combo(key)
    285 if func is not None and key in keymap and not overwrite:
--> 286     raise ValueError(
        trans = <napari.utils.translations.TranslationBundle object at 0x000002265A114730>
        key = 'C'
    287         trans._(
    288             'key combination {key} already used! specify \'overwrite=True\' to bypass this check',
    289             deferred=True,
    290             key=key,
    291         )
    292     )
    294 unbound = keymap.pop(key, None)
    296 if func is not None:

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

To reproduce:

Open the plugin in napari, close it again, and re-open it.

Fix

The error message points to this line in the code. Adding an overwrite=True to this line fixes it.

PR coming :)

@jo-mueller jo-mueller linked a pull request Oct 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant