Skip to main content

Attaches a customizable Tools menu to napari

Project description

napari-tools-menu

License PyPI Python Version tests codecov

Attaches a customizable Tools menu to napari

img.png

Usage

Just add napari-tools-menu to the dependencies of your napari-plugin. Afterwards, you can annotate your functions and dock widgets using the following syntax. The specified menu path will be used to put your tool in the right place in the tools menu. All menus and sub-menus will be listed alphabetically.

from napari_tools_menu import register_function, register_action, register_dock_widget


@register_action(menu="Utilities > Action")
def test_function(viewer):
    print("hello")


@register_function(menu="Utilities > Function")
def test_function_with_params(sigma: float = 0.5):
    print("sigma", sigma)


@register_dock_widget(menu="Utilities > Widget")
class ExampleQWidget(QWidget):
    def __init__(self, napari_viewer):

Menu name suggestions

To keep the Tools menu clean and organized, some suggestions should be made. Create category menus that classify your tool in a way such that a broad audience knows what it's doing. Examples:

  • Registration
  • Segmentation
  • Measurement
  • Visualization
  • Utilities
    Put a descriptive function name in the menu name first and the implementation behind. Examples:
  • Segmentation > Threshold (Otsu et al 1979)
  • Segmentation > Threshold (my algorithm)
  • Segmentation > Cell labeling (CellLab)
  • Segmentation > Nuclei segmentation (Nuc-Dect)

Again, there are no constraints. However, please make the life of (y)our users easy by keeping this menu well organized.

Installation

You can install napari-tools-menu via pip:

pip install napari-tools-menu

Contributing

Contributions are very welcome. Tests can be run with [pytest], please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the BSD-3 license, "napari-tools-menu" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari-tools-menu-0.1.1.tar.gz (5.4 kB view hashes)

Uploaded Source

Built Distribution

napari_tools_menu-0.1.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page