napari-plot 0.4.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. {napari_plot-0.4.0/napari_plot.egg-info → napari_plot-0.4.1}/PKG-INFO +1 -1
  2. napari_plot-0.4.1/napari_plot/_qt/layer_controls/qt_interval_controls.py +85 -0
  3. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_layer_controls_container.py +19 -1
  4. napari_plot-0.4.1/napari_plot/_qt/layer_controls/qt_rectangles_controls.py +149 -0
  5. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_layer_buttons.py +6 -0
  6. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_version.py +3 -3
  7. napari_plot-0.4.1/napari_plot/_vispy/layers/band.py +44 -0
  8. napari_plot-0.4.1/napari_plot/_vispy/layers/error_bar.py +146 -0
  9. napari_plot-0.4.1/napari_plot/_vispy/layers/rectangles.py +129 -0
  10. napari_plot-0.4.1/napari_plot/_vispy/overlays/text.py +88 -0
  11. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/utils/visual.py +19 -1
  12. napari_plot-0.4.1/napari_plot/_vispy/visuals/rectangles.py +126 -0
  13. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/legend.py +4 -2
  14. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/viewer_model.py +42 -3
  15. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/__init__.py +9 -1
  16. napari_plot-0.4.1/napari_plot/layers/band.py +156 -0
  17. napari_plot-0.4.1/napari_plot/layers/error_bar.py +172 -0
  18. napari_plot-0.4.1/napari_plot/layers/rectangles/__init__.py +5 -0
  19. napari_plot-0.4.1/napari_plot/layers/rectangles/rectangles.py +406 -0
  20. {napari_plot-0.4.0 → napari_plot-0.4.1/napari_plot.egg-info}/PKG-INFO +1 -1
  21. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/SOURCES.txt +15 -0
  22. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/scm_file_list.json +19 -0
  23. napari_plot-0.4.1/napari_plot.egg-info/scm_version.json +8 -0
  24. napari_plot-0.4.1/tests/_qt/test_interval_layers.py +111 -0
  25. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_layer_buttons.py +14 -1
  26. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_viewer.py +24 -8
  27. napari_plot-0.4.1/tests/_vispy/test_vispy_rectangles_layer.py +71 -0
  28. napari_plot-0.4.1/tests/layer_controls/test_qt_rectangles_controls.py +76 -0
  29. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/test_duplication.py +11 -1
  30. napari_plot-0.4.1/tests/layers/test_interval_layers.py +84 -0
  31. napari_plot-0.4.1/tests/layers/test_rectangles.py +94 -0
  32. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/test_registration.py +3 -0
  33. napari_plot-0.4.0/napari_plot/_vispy/overlays/text.py +0 -41
  34. napari_plot-0.4.0/napari_plot.egg-info/scm_version.json +0 -8
  35. {napari_plot-0.4.0 → napari_plot-0.4.1}/.deepsource.toml +0 -0
  36. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  37. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/ISSUE_TEMPLATE/documentation.md +0 -0
  38. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  39. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  40. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/TEST_FAIL_TEMPLATE.md +0 -0
  41. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/dependabot.yml +0 -0
  42. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/workflows/auto_author_assign.yml +0 -0
  43. {napari_plot-0.4.0 → napari_plot-0.4.1}/.github/workflows/test_and_deploy.yml +0 -0
  44. {napari_plot-0.4.0 → napari_plot-0.4.1}/.gitignore +0 -0
  45. {napari_plot-0.4.0 → napari_plot-0.4.1}/.pre-commit-config.yaml +0 -0
  46. {napari_plot-0.4.0 → napari_plot-0.4.1}/CHANGELOG.md +0 -0
  47. {napari_plot-0.4.0 → napari_plot-0.4.1}/LICENSE +0 -0
  48. {napari_plot-0.4.0 → napari_plot-0.4.1}/MANIFEST.in +0 -0
  49. {napari_plot-0.4.0 → napari_plot-0.4.1}/Makefile +0 -0
  50. {napari_plot-0.4.0 → napari_plot-0.4.1}/README.md +0 -0
  51. {napari_plot-0.4.0 → napari_plot-0.4.1}/codecov.yml +0 -0
  52. {napari_plot-0.4.0 → napari_plot-0.4.1}/conftest.py +0 -0
  53. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/__init__.py +0 -0
  54. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/__main__.py +0 -0
  55. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/__init__.py +0 -0
  56. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/_app.py +0 -0
  57. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/actions/__init__.py +0 -0
  58. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/actions/_layerlist_context_actions.py +0 -0
  59. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/constants/__init__.py +0 -0
  60. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/constants/_menus.py +0 -0
  61. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/context/__init__.py +0 -0
  62. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/context/_context.py +0 -0
  63. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/context/_context_keys.py +0 -0
  64. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/context/_layerlist_context.py +0 -0
  65. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_app_model/utils.py +0 -0
  66. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_contribution.py +0 -0
  67. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_plot_widget.py +0 -0
  68. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/__init__.py +0 -0
  69. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/_qapp_model/__init__.py +0 -0
  70. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/_qapp_model/_qproviders.py +0 -0
  71. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/component_controls/__init__.py +0 -0
  72. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/component_controls/qt_axis_controls.py +0 -0
  73. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/component_controls/qt_camera_controls.py +0 -0
  74. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/component_controls/qt_legend_controls.py +0 -0
  75. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/__init__.py +0 -0
  76. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_bar_controls.py +0 -0
  77. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_centroids_controls.py +0 -0
  78. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_infline_controls.py +0 -0
  79. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_layer_controls_base.py +0 -0
  80. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_layers_dialog.py +0 -0
  81. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_line_controls.py +0 -0
  82. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_multiline_controls.py +0 -0
  83. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_region_controls.py +0 -0
  84. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_scatter_controls.py +0 -0
  85. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/layer_controls/qt_text_controls.py +0 -0
  86. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_event_loop.py +0 -0
  87. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_layer_list.py +0 -0
  88. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_main_window.py +0 -0
  89. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_toolbar.py +0 -0
  90. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_viewer.py +0 -0
  91. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/qt_welcome.py +0 -0
  92. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/widgets/__init__.py +0 -0
  93. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/widgets/qt_dev.py +0 -0
  94. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/widgets/qt_icon_button.py +0 -0
  95. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_qt/widgets/qt_splash_screen.py +0 -0
  96. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_scatter_widget.py +0 -0
  97. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/__init__.py +0 -0
  98. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/camera.py +0 -0
  99. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/canvas.py +0 -0
  100. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/components/__init__.py +0 -0
  101. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/components/axis.py +0 -0
  102. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/components/camera.py +0 -0
  103. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/__init__.py +0 -0
  104. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/bar.py +0 -0
  105. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/centroids.py +0 -0
  106. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/infline.py +0 -0
  107. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/line.py +0 -0
  108. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/multiline.py +0 -0
  109. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/region.py +0 -0
  110. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/scatter.py +0 -0
  111. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/layers/text.py +0 -0
  112. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/overlays/__init__.py +0 -0
  113. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/overlays/axis.py +0 -0
  114. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/overlays/grid_lines.py +0 -0
  115. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/overlays/legend.py +0 -0
  116. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/tools/__init__.py +0 -0
  117. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/tools/drag.py +0 -0
  118. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/tools/polygon.py +0 -0
  119. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/utils/__init__.py +0 -0
  120. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/utils/axis.py +0 -0
  121. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/__init__.py +0 -0
  122. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/bar.py +0 -0
  123. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/centroids.py +0 -0
  124. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/infline.py +0 -0
  125. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/line.py +0 -0
  126. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/multiline.py +0 -0
  127. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/region.py +0 -0
  128. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/_vispy/visuals/scatter.py +0 -0
  129. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/__init__.py +0 -0
  130. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/_viewer_key_bindings.py +0 -0
  131. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/_viewer_mouse_bindings.py +0 -0
  132. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/_viewer_utils.py +0 -0
  133. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/axis.py +0 -0
  134. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/camera.py +0 -0
  135. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/dragtool.py +0 -0
  136. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/grid_lines.py +0 -0
  137. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/gridlines.py +0 -0
  138. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/layerlist.py +0 -0
  139. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/scene.py +0 -0
  140. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/components/tools.py +0 -0
  141. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/bar/__init__.py +0 -0
  142. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/bar/bar.py +0 -0
  143. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/base.py +0 -0
  144. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/centroids/__init__.py +0 -0
  145. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/centroids/_centroids_constants.py +0 -0
  146. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/centroids/_centroids_key_bindings.py +0 -0
  147. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/centroids/_centroids_utils.py +0 -0
  148. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/centroids/centroids.py +0 -0
  149. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/__init__.py +0 -0
  150. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline.py +0 -0
  151. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline_constants.py +0 -0
  152. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline_key_bindings.py +0 -0
  153. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline_list.py +0 -0
  154. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline_mouse_bindings.py +0 -0
  155. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/_infline_utils.py +0 -0
  156. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/infline/infline.py +0 -0
  157. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/line/__init__.py +0 -0
  158. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/line/_line_constants.py +0 -0
  159. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/line/_line_key_bindings.py +0 -0
  160. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/line/line.py +0 -0
  161. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/__init__.py +0 -0
  162. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/_multiline_constants.py +0 -0
  163. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/_multiline_key_bindings.py +0 -0
  164. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/_multiline_list.py +0 -0
  165. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/_multiline_utils.py +0 -0
  166. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/multiline/multiline.py +0 -0
  167. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/__init__.py +0 -0
  168. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region.py +0 -0
  169. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region_constants.py +0 -0
  170. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region_key_bindings.py +0 -0
  171. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region_list.py +0 -0
  172. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region_mouse_bindings.py +0 -0
  173. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/_region_utils.py +0 -0
  174. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/region/region.py +0 -0
  175. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/scatter/__init__.py +0 -0
  176. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/scatter/_scatter_key_bindings.py +0 -0
  177. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/scatter/_utilities.py +0 -0
  178. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/scatter/scatter.py +0 -0
  179. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/text/__init__.py +0 -0
  180. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/text/text.py +0 -0
  181. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/utils/__init__.py +0 -0
  182. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/layers/utils/layer_utils.py +0 -0
  183. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/napari.yaml +0 -0
  184. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/__init__.py +0 -0
  185. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icon.icns +0 -0
  186. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icon.ico +0 -0
  187. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/logo_silhouette_plot.svg +0 -0
  188. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/new_centroids.svg +0 -0
  189. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/new_inf_line.svg +0 -0
  190. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/new_line.svg +0 -0
  191. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/new_region.svg +0 -0
  192. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/icons/new_scatter.svg +0 -0
  193. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/logo.png +0 -0
  194. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/resources/qss/10_napari_plot.qss +0 -0
  195. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/__init__.py +0 -0
  196. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/_test_support.py +0 -0
  197. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/_tool.py +0 -0
  198. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/action_manager.py +0 -0
  199. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/system.py +0 -0
  200. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/utils/utilities.py +0 -0
  201. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/viewer.py +0 -0
  202. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot/window.py +0 -0
  203. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/dependency_links.txt +0 -0
  204. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/entry_points.txt +0 -0
  205. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/not-zip-safe +0 -0
  206. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/requires.txt +0 -0
  207. {napari_plot-0.4.0 → napari_plot-0.4.1}/napari_plot.egg-info/top_level.txt +0 -0
  208. {napari_plot-0.4.0 → napari_plot-0.4.1}/pyproject.toml +0 -0
  209. {napari_plot-0.4.0 → napari_plot-0.4.1}/renovate.json +0 -0
  210. {napari_plot-0.4.0 → napari_plot-0.4.1}/scripts/png_to_icon.bat +0 -0
  211. {napari_plot-0.4.0 → napari_plot-0.4.1}/scripts/qtaicons.bat +0 -0
  212. {napari_plot-0.4.0 → napari_plot-0.4.1}/setup.cfg +0 -0
  213. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/__init__.py +0 -0
  214. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_app_model/__init__.py +0 -0
  215. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_app_model/test_app.py +0 -0
  216. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_app_model/test_constants.py +0 -0
  217. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_app_model/test_context.py +0 -0
  218. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_app_model/test_layerlist_context.py +0 -0
  219. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/__init__.py +0 -0
  220. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_axis_controls.py +0 -0
  221. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_layer_control_icons.py +0 -0
  222. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_layer_control_sliders.py +0 -0
  223. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_layer_list.py +0 -0
  224. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_legend.py +0 -0
  225. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_splash_screen.py +0 -0
  226. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_qt/test_qt_window.py +0 -0
  227. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/__init__.py +0 -0
  228. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_axis.py +0 -0
  229. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_camera.py +0 -0
  230. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_bar_layer.py +0 -0
  231. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_infline_layer.py +0 -0
  232. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_line_layer.py +0 -0
  233. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_region_layer.py +0 -0
  234. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_scatter_layer.py +0 -0
  235. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_text_layer.py +0 -0
  236. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/_vispy/test_vispy_tools.py +0 -0
  237. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/__init__.py +0 -0
  238. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/test_axis.py +0 -0
  239. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/test_camera.py +0 -0
  240. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/test_tools.py +0 -0
  241. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/test_viewer_model.py +0 -0
  242. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/components/test_viewer_mouse_bindings.py +0 -0
  243. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/__init__.py +0 -0
  244. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_bar_controls.py +0 -0
  245. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_infline_controls.py +0 -0
  246. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_line_controls.py +0 -0
  247. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_multiline_controls.py +0 -0
  248. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_region_controls.py +0 -0
  249. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_scatter_controls.py +0 -0
  250. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layer_controls/test_qt_text_controls.py +0 -0
  251. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/__init__.py +0 -0
  252. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/centroids/__init__.py +0 -0
  253. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/centroids/test_centroids.py +0 -0
  254. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/infline/__init__.py +0 -0
  255. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/infline/test_infline.py +0 -0
  256. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/infline/test_infline_list.py +0 -0
  257. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/infline/test_infline_mouse_bindings.py +0 -0
  258. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/infline/test_infline_utils.py +0 -0
  259. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/line/__init__.py +0 -0
  260. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/line/test_line.py +0 -0
  261. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/multiline/__init__.py +0 -0
  262. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/multiline/test_multiline.py +0 -0
  263. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/multiline/test_multiline_list.py +0 -0
  264. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/multiline/test_multiline_utils.py +0 -0
  265. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/region/__init__.py +0 -0
  266. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/region/test_region.py +0 -0
  267. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/region/test_region_mouse_bindings.py +0 -0
  268. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/scatter/__init__.py +0 -0
  269. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/scatter/test_scatter.py +0 -0
  270. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/test_bar.py +0 -0
  271. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/text/__init__.py +0 -0
  272. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/layers/text/test_text.py +0 -0
  273. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_examples.py +0 -0
  274. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_lazy_import.py +0 -0
  275. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_napari_010.py +0 -0
  276. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_plot_widget.py +0 -0
  277. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_plotting_api.py +0 -0
  278. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/test_scatter_widget.py +0 -0
  279. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/utils/__init__.py +0 -0
  280. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/utils/test_tool.py +0 -0
  281. {napari_plot-0.4.0 → napari_plot-0.4.1}/tests/utils/test_utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: napari_plot
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Plugin providing support for 1d plotting in napari
5
5
  Author-email: Lukasz Migas <lukas.migas@yahoo.com>
6
6
  License: BSD 3-Clause
@@ -0,0 +1,85 @@
1
+ """Appearance controls for bands and error bars."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import qtextra.helpers as hp
8
+ from napari._qt.utils import qt_signals_blocked
9
+
10
+ from napari_plot._qt.layer_controls.qt_layer_controls_base import QtLayerControls
11
+
12
+ if TYPE_CHECKING:
13
+ import numpy as np
14
+
15
+ from napari_plot.layers import Band, ErrorBar
16
+
17
+
18
+ class QtBandControls(QtLayerControls):
19
+ """Edit band color, opacity, and blending."""
20
+
21
+ layer: Band
22
+
23
+ def __init__(self, layer: Band) -> None:
24
+ super().__init__(layer)
25
+ self.fill_color_swatch = hp.make_swatch(self, layer.fill_color, func=self._set_fill_color)
26
+ layer.events.fill_color.connect(self._on_fill_color_change)
27
+
28
+ self.layout().addRow(self.button_grid)
29
+ self.layout().addRow(self.opacity_label, self.opacity_slider)
30
+ self.layout().addRow(hp.make_label(self, "blending"), self.blending_combobox)
31
+ self.layout().addRow(hp.make_label(self, "fill color"), self.fill_color_swatch)
32
+
33
+ def _set_fill_color(self, value: np.ndarray) -> None:
34
+ self.layer.fill_color = value
35
+
36
+ def _on_fill_color_change(self) -> None:
37
+ with qt_signals_blocked(self.fill_color_swatch):
38
+ self.fill_color_swatch.set_color(self.layer.fill_color, force=True)
39
+
40
+
41
+ class QtErrorBarControls(QtLayerControls):
42
+ """Edit the appearance of error bar stems and caps."""
43
+
44
+ layer: ErrorBar
45
+
46
+ def __init__(self, layer: ErrorBar) -> None:
47
+ super().__init__(layer)
48
+ self.color_swatch = hp.make_swatch(self, layer.color, func=self._set_color)
49
+ self.width_spinbox = hp.make_double_spin_box(
50
+ self, minimum=0.01, maximum=20, n_decimals=1, step_size=0.5, value=layer.width, func=self._set_width
51
+ )
52
+ self.cap_size_spinbox = hp.make_double_spin_box(
53
+ self, minimum=0, maximum=20, n_decimals=1, step_size=0.5, value=layer.cap_size, func=self._set_cap_size
54
+ )
55
+ layer.events.color.connect(self._on_color_change)
56
+ layer.events.width.connect(self._on_width_change)
57
+ layer.events.cap_size.connect(self._on_cap_size_change)
58
+
59
+ self.layout().addRow(self.button_grid)
60
+ self.layout().addRow(self.opacity_label, self.opacity_slider)
61
+ self.layout().addRow(hp.make_label(self, "blending"), self.blending_combobox)
62
+ self.layout().addRow(hp.make_label(self, "color"), self.color_swatch)
63
+ self.layout().addRow(hp.make_label(self, "line width (px)"), self.width_spinbox)
64
+ self.layout().addRow(hp.make_label(self, "cap size (px)"), self.cap_size_spinbox)
65
+
66
+ def _set_color(self, value: np.ndarray) -> None:
67
+ self.layer.color = value
68
+
69
+ def _set_width(self, value: float) -> None:
70
+ self.layer.width = value
71
+
72
+ def _set_cap_size(self, value: float) -> None:
73
+ self.layer.cap_size = value
74
+
75
+ def _on_color_change(self) -> None:
76
+ with qt_signals_blocked(self.color_swatch):
77
+ self.color_swatch.set_color(self.layer.color, force=True)
78
+
79
+ def _on_width_change(self) -> None:
80
+ with qt_signals_blocked(self.width_spinbox):
81
+ self.width_spinbox.setValue(self.layer.width)
82
+
83
+ def _on_cap_size_change(self) -> None:
84
+ with qt_signals_blocked(self.cap_size_spinbox):
85
+ self.cap_size_spinbox.setValue(self.layer.cap_size)
@@ -19,12 +19,26 @@ from qtpy.QtWidgets import QFrame
19
19
  from napari_plot._qt.layer_controls.qt_bar_controls import QtBarControls
20
20
  from napari_plot._qt.layer_controls.qt_centroids_controls import QtCentroidControls
21
21
  from napari_plot._qt.layer_controls.qt_infline_controls import QtInfLineControls
22
+ from napari_plot._qt.layer_controls.qt_interval_controls import QtBandControls, QtErrorBarControls
22
23
  from napari_plot._qt.layer_controls.qt_line_controls import QtLineControls
23
24
  from napari_plot._qt.layer_controls.qt_multiline_controls import QtMultiLineControls
25
+ from napari_plot._qt.layer_controls.qt_rectangles_controls import QtRectanglesControls
24
26
  from napari_plot._qt.layer_controls.qt_region_controls import QtRegionControls
25
27
  from napari_plot._qt.layer_controls.qt_scatter_controls import QtScatterControls
26
28
  from napari_plot._qt.layer_controls.qt_text_controls import QtTextControls
27
- from napari_plot.layers import Bar, Centroids, InfLine, Line, MultiLine, Region, Scatter, Text
29
+ from napari_plot.layers import (
30
+ Band,
31
+ Bar,
32
+ Centroids,
33
+ ErrorBar,
34
+ InfLine,
35
+ Line,
36
+ MultiLine,
37
+ Rectangles,
38
+ Region,
39
+ Scatter,
40
+ Text,
41
+ )
28
42
 
29
43
  if TYPE_CHECKING:
30
44
  from napari.layers import Layer
@@ -32,10 +46,13 @@ if TYPE_CHECKING:
32
46
  from napari_plot.components.viewer_model import ViewerModel
33
47
 
34
48
  layer_to_controls = {
49
+ Band: QtBandControls,
35
50
  Bar: QtBarControls,
51
+ ErrorBar: QtErrorBarControls,
36
52
  Line: QtLineControls,
37
53
  Centroids: QtCentroidControls,
38
54
  Scatter: QtScatterControls,
55
+ Rectangles: QtRectanglesControls,
39
56
  Region: QtRegionControls,
40
57
  InfLine: QtInfLineControls,
41
58
  MultiLine: QtMultiLineControls,
@@ -121,6 +138,7 @@ __all__ = [
121
138
  "QtLayerControlsContainer",
122
139
  "QtLineControls",
123
140
  "QtMultiLineControls",
141
+ "QtRectanglesControls",
124
142
  "QtRegionControls",
125
143
  "QtScatterControls",
126
144
  "QtTextControls",
@@ -0,0 +1,149 @@
1
+ """Qt controls for the Rectangles layer."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import qtextra.helpers as hp
8
+ from napari._qt.utils import qt_signals_blocked, set_widgets_enabled_with_opacity
9
+ from napari.layers.points._points_constants import Symbol
10
+
11
+ from napari_plot._qt.layer_controls.qt_layer_controls_base import QtLayerControls
12
+
13
+ if TYPE_CHECKING:
14
+ from napari.utils.events import Event
15
+
16
+ from napari_plot.layers import Rectangles
17
+
18
+
19
+ class QtRectanglesControls(QtLayerControls):
20
+ """Control rectangle outlines, center markers, and labels."""
21
+
22
+ layer: Rectangles
23
+
24
+ def __init__(self, layer: Rectangles) -> None:
25
+ super().__init__(layer)
26
+ self.outlines_checkbox = hp.make_checkbox(self, value=layer.show_rectangles)
27
+ self.markers_checkbox = hp.make_checkbox(self, value=layer.show_markers)
28
+ self.text_checkbox = hp.make_checkbox(self, value=layer.show_text)
29
+ self.width_spinbox = hp.make_double_spin_box(
30
+ self,
31
+ minimum=0.01,
32
+ maximum=max(100, layer.outline_width),
33
+ step_size=0.5,
34
+ n_decimals=2,
35
+ value=layer.outline_width,
36
+ tooltip="Outline width in screen pixels.",
37
+ )
38
+ self.marker_size_spinbox = hp.make_double_spin_box(
39
+ self,
40
+ step_size=1,
41
+ n_decimals=2,
42
+ special_value="Per marker",
43
+ tooltip="Set all marker sizes in screen pixels.",
44
+ func=self._set_marker_size,
45
+ )
46
+ self.marker_symbol_combobox = hp.make_combobox(
47
+ self,
48
+ data={str(symbol): symbol.name.lower().replace("_", " ") for symbol in Symbol},
49
+ tooltip="Set the symbol for all markers.",
50
+ func_index=self._set_marker_symbol,
51
+ )
52
+ self.marker_symbol_combobox.setPlaceholderText("Per marker")
53
+ self.text_size_spinbox = hp.make_double_spin_box(
54
+ self,
55
+ step_size=1,
56
+ n_decimals=2,
57
+ special_value="Application default",
58
+ tooltip="Font size in points.",
59
+ func=self._set_text_size,
60
+ )
61
+ self.outlines_checkbox.toggled.connect(self._set_outlines)
62
+ self.markers_checkbox.toggled.connect(self._set_markers)
63
+ self.text_checkbox.toggled.connect(self._set_text)
64
+ self.width_spinbox.valueChanged.connect(self._set_width)
65
+
66
+ layout = self.layout()
67
+ layout.addRow(self.button_grid)
68
+ layout.addRow(self.opacity_label, self.opacity_slider)
69
+ layout.addRow(hp.make_label(self, "blending"), self.blending_combobox)
70
+ layout.addRow(hp.make_label(self, "show outlines"), self.outlines_checkbox)
71
+ layout.addRow(hp.make_label(self, "outline width"), self.width_spinbox)
72
+ layout.addRow(hp.make_label(self, "show markers"), self.markers_checkbox)
73
+ layout.addRow(hp.make_label(self, "marker size"), self.marker_size_spinbox)
74
+ layout.addRow(hp.make_label(self, "marker type"), self.marker_symbol_combobox)
75
+ layout.addRow(hp.make_label(self, "show text"), self.text_checkbox)
76
+ layout.addRow(hp.make_label(self, "font size"), self.text_size_spinbox)
77
+
78
+ layer.events.show_rectangles.connect(self._on_style_change)
79
+ layer.events.show_markers.connect(self._on_style_change)
80
+ layer.events.show_text.connect(self._on_style_change)
81
+ layer.events.outline_width.connect(self._on_style_change)
82
+ layer.events.marker_size.connect(self._on_style_change)
83
+ layer.events.marker_symbol.connect(self._on_style_change)
84
+ layer.events.text_size.connect(self._on_style_change)
85
+ layer.events.visible.connect(self._on_visible_change)
86
+ self._on_style_change()
87
+ self._on_visible_change()
88
+
89
+ def _set_outlines(self, checked: bool) -> None:
90
+ self.layer.show_rectangles = checked
91
+
92
+ def _set_markers(self, checked: bool) -> None:
93
+ self.layer.show_markers = checked
94
+
95
+ def _set_text(self, checked: bool) -> None:
96
+ self.layer.show_text = checked
97
+
98
+ def _set_width(self, value: float) -> None:
99
+ self.layer.outline_width = value
100
+
101
+ def _set_marker_size(self, value: float) -> None:
102
+ if value > 0:
103
+ self.layer.marker_size = value
104
+ else:
105
+ self._on_style_change()
106
+
107
+ def _set_marker_symbol(self, index: int) -> None:
108
+ if index >= 0:
109
+ self.layer.marker_symbol = self.marker_symbol_combobox.itemData(index)
110
+
111
+ def _set_text_size(self, value: float) -> None:
112
+ self.layer.text_size = value or None
113
+
114
+ def _on_style_change(self, _event: Event | None = None) -> None:
115
+ for checkbox, checked in (
116
+ (self.outlines_checkbox, self.layer.show_rectangles),
117
+ (self.markers_checkbox, self.layer.show_markers),
118
+ (self.text_checkbox, self.layer.show_text),
119
+ ):
120
+ with qt_signals_blocked(checkbox):
121
+ checkbox.setChecked(checked)
122
+ marker_size = self.layer.marker_size
123
+ for spinbox, value in (
124
+ (self.width_spinbox, self.layer.outline_width),
125
+ (self.marker_size_spinbox, max(0.01, marker_size) if isinstance(marker_size, float) else 0),
126
+ (self.text_size_spinbox, max(0.01, self.layer.text_size) if self.layer.text_size is not None else 0),
127
+ ):
128
+ with qt_signals_blocked(spinbox):
129
+ spinbox.setMaximum(max(100, value))
130
+ spinbox.setValue(value)
131
+ symbol = self.layer.marker_symbol
132
+ with qt_signals_blocked(self.marker_symbol_combobox):
133
+ index = self.marker_symbol_combobox.findData(symbol) if isinstance(symbol, str) else -1
134
+ self.marker_symbol_combobox.setCurrentIndex(index)
135
+
136
+ def _on_visible_change(self, _event: Event | None = None) -> None:
137
+ set_widgets_enabled_with_opacity(
138
+ self,
139
+ [
140
+ self.outlines_checkbox,
141
+ self.width_spinbox,
142
+ self.markers_checkbox,
143
+ self.marker_size_spinbox,
144
+ self.marker_symbol_combobox,
145
+ self.text_checkbox,
146
+ self.text_size_spinbox,
147
+ ],
148
+ self.layer.visible,
149
+ )
@@ -35,7 +35,10 @@ def _add_empty_layer(viewer, layer_name: str):
35
35
  "Points": lambda: viewer.add_points(ndim=max(viewer.dims.ndim, 2), scale=scale),
36
36
  "Shapes": lambda: viewer.add_shapes(ndim=max(viewer.dims.ndim, 2), scale=scale),
37
37
  "Line": lambda: viewer.add_line(np.empty((0, 2)), scale=scale, name="Line"),
38
+ "Band": lambda: viewer.add_band(scale=scale, name="Band"),
38
39
  "Bar": lambda: viewer.add_bar(None, scale=scale, name="Bar"),
40
+ "ErrorBar": lambda: viewer.add_error_bar(scale=scale, name="Error bars"),
41
+ "Rectangles": lambda: viewer.add_rectangles(scale=scale, name="Rectangles"),
39
42
  "Scatter": lambda: viewer.add_scatter(None, scale=scale, name="Scatter"),
40
43
  "MultiLine": lambda: viewer.add_multi_line(None, scale=scale, name="MultiLine"),
41
44
  "Centroids": lambda: viewer.add_centroids(None, scale=scale, name="Centroids"),
@@ -51,7 +54,10 @@ def create_add_layer_menu(parent: QWidget, viewer) -> QMenu:
51
54
  menu = QMenu(parent)
52
55
  for layer_name in (
53
56
  "Line",
57
+ "Band",
54
58
  "Bar",
59
+ "ErrorBar",
60
+ "Rectangles",
55
61
  "Scatter",
56
62
  "MultiLine",
57
63
  "Centroids",
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.4.0'
22
- __version_tuple__ = version_tuple = (0, 4, 0)
21
+ __version__ = version = '0.4.1'
22
+ __version_tuple__ = version_tuple = (0, 4, 1)
23
23
 
24
- __commit_id__ = commit_id = 'g1ed0919df'
24
+ __commit_id__ = commit_id = 'g575f2d067'
@@ -0,0 +1,44 @@
1
+ """VisPy adapter for a filled band."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import numpy as np
8
+ from napari._vispy.layers.base import VispyBaseLayer
9
+ from vispy.scene.visuals import Mesh
10
+
11
+ if TYPE_CHECKING:
12
+ from napari._vispy.utils.qt_font import FontInfo
13
+
14
+ from napari_plot.layers.band import Band
15
+
16
+
17
+ class VispyBandLayer(VispyBaseLayer):
18
+ """Draw all connected band intervals in one mesh."""
19
+
20
+ layer: Band
21
+ node: Mesh
22
+
23
+ def __init__(self, layer: Band, font_info: FontInfo) -> None:
24
+ self._has_triangles = False
25
+ super().__init__(layer, Mesh(), font_info=font_info)
26
+ layer.events.fill_color.connect(self._on_fill_color_change)
27
+ self.reset()
28
+ self._on_data_change()
29
+
30
+ def _on_data_change(self) -> None:
31
+ triangles = self.layer._triangles()
32
+ self._has_triangles = bool(len(triangles))
33
+ if self._has_triangles:
34
+ vertices = triangles.reshape(-1, 2)
35
+ faces = np.arange(len(vertices), dtype=np.uint32).reshape(-1, 3)
36
+ self.node.set_data(vertices=vertices, faces=faces, color=self.layer.fill_color)
37
+ self._on_visible_change()
38
+ self.node.update()
39
+
40
+ def _on_visible_change(self) -> None:
41
+ self.node.visible = self.layer.visible and self._has_triangles
42
+
43
+ def _on_fill_color_change(self) -> None:
44
+ self.node.color = self.layer.fill_color
@@ -0,0 +1,146 @@
1
+ """Draw error intervals with thickness and caps measured in screen pixels."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import numpy as np
8
+ from napari._vispy.layers.base import VispyBaseLayer
9
+ from vispy.gloo import IndexBuffer, VertexBuffer
10
+ from vispy.scene.visuals import create_visual_node
11
+ from vispy.visuals import Visual
12
+
13
+ if TYPE_CHECKING:
14
+ from napari._vispy.utils.qt_font import FontInfo
15
+
16
+ from napari_plot.layers.error_bar import ErrorBar
17
+
18
+ _VERTEX_SHADER = """
19
+ attribute vec2 a_start;
20
+ attribute vec2 a_end;
21
+ attribute vec2 a_corner;
22
+ attribute float a_cap;
23
+ uniform float u_half_width;
24
+ uniform float u_half_cap;
25
+
26
+ void main() {
27
+ vec4 start = $to_framebuffer(vec4(a_start, 0.0, 1.0));
28
+ vec4 end = $to_framebuffer(vec4(a_end, 0.0, 1.0));
29
+ vec2 delta = end.xy - start.xy;
30
+ vec2 along = delta / max(length(delta), 1e-6);
31
+ vec2 normal = vec2(-along.y, along.x);
32
+
33
+ vec4 vertex;
34
+ if (a_cap < 0.0) {
35
+ vertex = mix(start, end, a_corner.x);
36
+ vertex.xy += a_corner.y * u_half_width * normal;
37
+ } else {
38
+ vertex = mix(start, end, a_cap);
39
+ vertex.xy += a_corner.x * u_half_cap * normal + a_corner.y * u_half_width * along;
40
+ }
41
+ gl_Position = $to_render(vertex);
42
+ }
43
+ """
44
+
45
+ _FRAGMENT_SHADER = """
46
+ uniform vec4 u_color;
47
+
48
+ void main() {
49
+ gl_FragColor = u_color;
50
+ }
51
+ """
52
+
53
+ # Four corners for the stem, then four for each cap. The last column identifies the piece.
54
+ _CORNERS = np.array(
55
+ [
56
+ (0, -1, -1),
57
+ (1, -1, -1),
58
+ (1, 1, -1),
59
+ (0, 1, -1),
60
+ (-1, -1, 0),
61
+ (-1, 1, 0),
62
+ (1, 1, 0),
63
+ (1, -1, 0),
64
+ (-1, -1, 1),
65
+ (-1, 1, 1),
66
+ (1, 1, 1),
67
+ (1, -1, 1),
68
+ ],
69
+ dtype=np.float32,
70
+ )
71
+ _INDICES = np.array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11], dtype=np.uint32)
72
+
73
+
74
+ class ErrorBarVisual(Visual):
75
+ """Render all stems and caps in one indexed batch."""
76
+
77
+ def __init__(self) -> None:
78
+ super().__init__(vcode=_VERTEX_SHADER, fcode=_FRAGMENT_SHADER)
79
+ self._vertices = VertexBuffer()
80
+ self._index_buffer = IndexBuffer()
81
+ self._draw_mode = "triangles"
82
+ self._count = 0
83
+ self._width = 1.0
84
+ self._cap_size = 0.0
85
+ self.freeze()
86
+
87
+ def set_segments(self, segments: np.ndarray) -> None:
88
+ """Upload (x, y) endpoints for each stem and its two caps."""
89
+ count = len(segments)
90
+ if count:
91
+ vertices = np.empty(
92
+ (count, len(_CORNERS)), dtype=[("a_start", "2f"), ("a_end", "2f"), ("a_corner", "2f"), ("a_cap", "f")]
93
+ )
94
+ vertices["a_start"] = segments[:, :1]
95
+ vertices["a_end"] = segments[:, 1:]
96
+ vertices["a_corner"] = _CORNERS[:, :2]
97
+ vertices["a_cap"] = _CORNERS[:, 2]
98
+ self._vertices.set_data(vertices.ravel())
99
+ self.shared_program.bind(self._vertices)
100
+ if count != self._count:
101
+ offsets = np.arange(count, dtype=np.uint32)[:, None] * len(_CORNERS)
102
+ self._index_buffer.set_data((offsets + _INDICES).ravel())
103
+ self._count = count
104
+ self.update()
105
+
106
+ def set_style(self, color: np.ndarray, width: float, cap_size: float) -> None:
107
+ """Set RGBA and logical pixel sizes without rebuilding geometry."""
108
+ self.shared_program["u_color"] = tuple(color)
109
+ self._width = width
110
+ self._cap_size = cap_size
111
+ self.update()
112
+
113
+ def _prepare_transforms(self, view: Visual) -> None:
114
+ view.view_program.vert["to_framebuffer"] = view.get_transform("visual", "framebuffer")
115
+ view.view_program.vert["to_render"] = view.get_transform("framebuffer", "render")
116
+
117
+ def _prepare_draw(self, view: Visual) -> bool:
118
+ pixel_scale = view.transforms.pixel_scale
119
+ view.view_program["u_half_width"] = self._width * pixel_scale / 2
120
+ view.view_program["u_half_cap"] = self._cap_size * pixel_scale / 2
121
+ return self._count > 0
122
+
123
+
124
+ _ErrorBarNode = create_visual_node(ErrorBarVisual)
125
+
126
+
127
+ class VispyErrorBarLayer(VispyBaseLayer):
128
+ """Upload error intervals and keep their appearance in sync."""
129
+
130
+ layer: ErrorBar
131
+ node: ErrorBarVisual
132
+
133
+ def __init__(self, layer: ErrorBar, font_info: FontInfo) -> None:
134
+ super().__init__(layer, _ErrorBarNode(), font_info=font_info)
135
+ layer.events.color.connect(self._on_style_change)
136
+ layer.events.width.connect(self._on_style_change)
137
+ layer.events.cap_size.connect(self._on_style_change)
138
+ self.reset()
139
+ self._on_style_change()
140
+ self._on_data_change()
141
+
142
+ def _on_data_change(self) -> None:
143
+ self.node.set_segments(self.layer._segments())
144
+
145
+ def _on_style_change(self) -> None:
146
+ self.node.set_style(self.layer.color, self.layer.width, self.layer.cap_size)
@@ -0,0 +1,129 @@
1
+ """Sync the Rectangles layer with its VisPy subvisuals."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import numpy as np
8
+ from napari._vispy.layers.base import VispyBaseLayer
9
+
10
+ from napari_plot._vispy.visuals.rectangles import RectanglesVisual
11
+
12
+ if TYPE_CHECKING:
13
+ from napari._vispy.utils.qt_font import FontInfo
14
+ from napari.utils.events import Event
15
+
16
+ from napari_plot.layers import Rectangles
17
+
18
+
19
+ class VispyRectanglesLayer(VispyBaseLayer["Rectangles"]):
20
+ """Upload only changed, enabled components of a Rectangles layer."""
21
+
22
+ node: RectanglesVisual
23
+
24
+ def __init__(self, layer: Rectangles, font_info: FontInfo) -> None:
25
+ super().__init__(layer, RectanglesVisual(font_info), font_info=font_info)
26
+ self._data: np.ndarray | None = None
27
+ self._outline_geometry_dirty = True
28
+ self._outline_color_dirty = True
29
+ self._markers_dirty = True
30
+ self._labels_dirty = True
31
+ layer.events.data.connect(self._on_data_change)
32
+ layer.events.show_rectangles.connect(self._sync_outlines)
33
+ layer.events.outline_color.connect(self._on_outline_color_change)
34
+ layer.events.outline_width.connect(self._on_outline_width_change)
35
+ layer.events.show_markers.connect(self._sync_markers)
36
+ layer.events.marker_size.connect(self._on_markers_change)
37
+ layer.events.marker_color.connect(self._on_markers_change)
38
+ layer.events.marker_symbol.connect(self._on_markers_change)
39
+ layer.events.show_text.connect(self._sync_labels)
40
+ layer.events.text.connect(self._on_labels_change)
41
+ layer.events.text_offset.connect(self._on_labels_change)
42
+ layer.events.text_size.connect(self._on_font_size_change)
43
+ layer.events.text_color.connect(self._on_text_color_change)
44
+ self.reset()
45
+ self._on_outline_width_change()
46
+ self._on_font_size_change()
47
+ self._on_text_color_change()
48
+ self._on_data_change()
49
+
50
+ def _on_data_change(self, _event: Event | None = None) -> None:
51
+ data = self.layer.data
52
+ if self._data is data:
53
+ return
54
+ self._outline_geometry_dirty = True
55
+ if self._data is None or len(self._data) != len(data):
56
+ self._outline_color_dirty = True
57
+ self._data = data
58
+ self._markers_dirty = True
59
+ self._labels_dirty = True
60
+ self._sync_outlines()
61
+ self._sync_markers()
62
+ self._sync_labels()
63
+
64
+ def _on_visible_change(self, event: Event | None = None) -> None:
65
+ super()._on_visible_change()
66
+ if self.layer.visible and self._data is not None:
67
+ self._sync_outlines()
68
+ self._sync_markers()
69
+ self._sync_labels()
70
+
71
+ def _on_outline_color_change(self, _event: Event | None = None) -> None:
72
+ self._outline_color_dirty = True
73
+ self._sync_outlines()
74
+
75
+ def _on_outline_width_change(self, _event: Event | None = None) -> None:
76
+ self.node.outlines.set_width(self.layer.outline_width)
77
+
78
+ def _sync_outlines(self, _event: Event | None = None) -> None:
79
+ outline = self.node.outlines
80
+ outline.visible = bool(self.layer.show_rectangles and len(self.layer.data))
81
+ if not (outline.visible and self.layer.visible):
82
+ return
83
+ if self._outline_geometry_dirty:
84
+ outline.set_geometry(self.layer.data)
85
+ self._outline_geometry_dirty = False
86
+ if self._outline_color_dirty:
87
+ outline.set_color(self.layer.outline_color)
88
+ self._outline_color_dirty = False
89
+
90
+ def _on_markers_change(self, _event: Event | None = None) -> None:
91
+ self._markers_dirty = True
92
+ self._sync_markers()
93
+
94
+ def _sync_markers(self, _event: Event | None = None) -> None:
95
+ markers = self.node.markers
96
+ markers.visible = bool(self.layer.show_markers and len(self.layer.data))
97
+ if markers.visible and self.layer.visible and self._markers_dirty:
98
+ markers.set_data(
99
+ pos=self.layer.centers,
100
+ size=self.layer.marker_size,
101
+ symbol=self.layer.marker_symbol,
102
+ edge_width=0,
103
+ face_color=self.layer.marker_color,
104
+ )
105
+ self._markers_dirty = False
106
+
107
+ def _on_labels_change(self, _event: Event | None = None) -> None:
108
+ self._labels_dirty = True
109
+ self._sync_labels()
110
+
111
+ def _sync_labels(self, _event: Event | None = None) -> None:
112
+ text = self.node.text
113
+ labels = self.layer.text
114
+ if not (self.layer.show_text and labels is not None and len(labels)):
115
+ text.visible = False
116
+ return
117
+ if self.layer.visible and self._labels_dirty:
118
+ labeled = labels != ""
119
+ text.text = labels[labeled].tolist()
120
+ text.pos = self.layer.centers[labeled] + self.layer.text_offset
121
+ self._labels_dirty = False
122
+ text.visible = bool(text.text)
123
+
124
+ def _on_text_color_change(self, _event: Event | None = None) -> None:
125
+ self.node.text.color = self.layer.text_color
126
+
127
+ def _on_font_size_change(self, _event: Event | None = None) -> None:
128
+ size = self.layer.text_size
129
+ self.node.text.font_size = self._default_font_size if size is None else size