Skip to content

Commit

Permalink
Merge branch 'main' into release-action
Browse files Browse the repository at this point in the history
  • Loading branch information
melissawm authored Oct 22, 2024
2 parents 12123f5 + 0bea5f0 commit d58ba17
Show file tree
Hide file tree
Showing 162 changed files with 296 additions and 143 deletions.
4 changes: 2 additions & 2 deletions docs/_scripts/update_preference_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from qtpy.QtWidgets import QMessageBox

from napari._qt.dialogs.preferences_dialog import PreferencesDialog
from napari._qt.qt_event_loop import get_app
from napari._qt.qt_event_loop import get_qapp
from napari._qt.qt_resources import get_stylesheet
from napari.settings import NapariSettings

Expand Down Expand Up @@ -99,7 +99,7 @@ def generate_images():
section of the docs.
"""

app = get_app()
app = get_qapp()
pref = PreferencesDialog()
pref.setStyleSheet(get_stylesheet("dark"))
pref.show()
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
9 changes: 7 additions & 2 deletions docs/_static/version_switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
"url": "https://napari.org/dev/"
},
{
"name": "stable (0.5.3)",
"version": "0.5.3",
"name": "stable (0.5.4)",
"version": "0.5.4",
"preferred": true,
"url": "https://napari.org/stable/"
},
{
"name": "0.5.3",
"version": "0.5.3",
"url": "https://napari.org/0.5.3/"
},
{
"name": "0.5.2",
"version": "0.5.2",
Expand Down
1 change: 1 addition & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ subtrees:
- file: release/index
subtrees:
- entries:
- file: release/release_0_5_4
- file: release/release_0_5_3
- file: release/release_0_5_2
- file: release/release_0_5_1
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_logo = "images/logo.png"
html_logo = "_static/images/logo.png"
html_sourcelink_suffix = ''
html_title = 'napari'

Expand Down Expand Up @@ -276,7 +276,7 @@ def napari_scraper(block, block_vars, gallery_conf):
"""
imgpath_iter = block_vars['image_path_iterator']

if app := napari.qt.get_app():
if app := napari.qt.get_qapp():
app.processEvents()
else:
return ""
Expand All @@ -301,7 +301,7 @@ def napari_scraper(block, block_vars, gallery_conf):
'gallery_dirs': 'gallery', # path to where to save gallery generated output
'filename_pattern': '/*.py',
'ignore_pattern': 'README.rst|/*_.py',
'default_thumb_file': Path(__file__).parent / 'images' / 'logo.png',
'default_thumb_file': Path(__file__).parent / '_static' / 'images' / 'logo.png',
'plot_gallery': "'True'", # https://github.com/sphinx-gallery/sphinx-gallery/pull/304/files
'download_all_examples': False,
'min_reported_time': 10,
Expand Down
20 changes: 10 additions & 10 deletions docs/developers/architecture/app_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The {class}`~napari._app_model._app.NapariApplication` (`app`)
is the top level object that stores information about the commands, keybindings
and menus that make up the application.
It is a subclass of {class}`app_model.Application` and is a global application
singleton. It can be retrieved with `napari._app_model.get_app`.
singleton. It can be retrieved with `napari._app_model.get_app_model`.

Currently, the primary purpose of the `app` is to compose the following
{mod}`app_model.registries` into a single name-spaced object:
Expand Down Expand Up @@ -106,10 +106,10 @@ The code below shows how to register the `action` defined above with the napari
singleton `app`:

```python
from napari._app_model import get_app
from napari._app_model import get_app_model


get_app().register_action(action)
get_app_model().register_action(action)
```

````{note}
Expand Down Expand Up @@ -395,7 +395,7 @@ current viewer, if one present (returning `None` if not). It is
registered in the `app.injection_store` via `app.injection_store.register_provider`. Processors can be registered in the same way.

```python
from napari._app_model import get_app
from napari._app_model import get_app_model

# return annotation indicates what this provider provides
def provide_points() -> Optional['Points']:
Expand All @@ -409,7 +409,7 @@ def provide_points() -> Optional['Points']:
None
)

get_app().injection_store.register_provider(provide_points)
get_app_model().injection_store.register_provider(provide_points)
```

This allows both internal and external functions to be injected with these
Expand All @@ -418,7 +418,7 @@ This is particularly important in a GUI context, where a user can't always be
providing arguments:

```python
>>> injected_func = get_app().injection_store.inject(process_points)
>>> injected_func = get_app_model().injection_store.inject(process_points)
```

Note: injection doesn't *inherently* mean that it's always safe to call an
Expand Down Expand Up @@ -502,11 +502,11 @@ On `napari` start up, `app-model` initialization occurs in the following order:
1. Initialize {class}`~napari.viewer.Viewer`, which calls
`napari.plugins._initialize_plugins`, which registers discovered plugins
and all their actions (non-Qt first, followed immedidately by Qt actions).
This also results in the first call to `napari._app_model.get_app`.
This also results in the first call to `napari._app_model.get_app_model`.

i. Instantiation of the `app-model` app results in registration of all non-GUI
internal `napari` actions (and associated submenus). Note that the
`napari._app_model.get_app` call creates the `app` only when *first*
`napari._app_model.get_app_model` call creates the `app` only when *first*
called. It simply returns the existing app on all subsequent calls.

2. {class}`~napari._qt.qt_main_window.Window` instantiation, followed by
Expand All @@ -532,8 +532,8 @@ singleton `app` may keep a reference to an object, e.g., a
since been cleaned up at the end of a previous test.
Thus, we mock the `app` in a `_mock_app` fixture, and
explicitly use it in {ref}`make_napari_viewer` as well as in all tests that
use the `get_app` function. This way, a new instance of `app` is returned
every time `napari._app_model.get_app`
use the `get_app_model` function. This way, a new instance of `app` is returned
every time `napari._app_model.get_app_model`
is used inside a test. This 'test' `app` is available for use throughout the test's
duration and will get cleaned up at the end.

Expand Down
8 changes: 4 additions & 4 deletions docs/developers/contributing/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,22 @@ you will only be able to preview the documentation on CircleCI.
Simply click on **Details** next to the `Check the rendered docs here!` at the bottom
of your pull request:

![CircleCI check is highlighted](images/circleci-link.png)
![CircleCI check is highlighted](../../../_static/images/circleci-link.png)

#### Download documentation artifact

1. Click on **Details** next to
`Build & Deploy PR Docs / Build & Upload Artifact (pull_request)`:

![The "Build & Deploy PR Docs / Build & Upload Artifact" check is highlighted](images/doc-ci-1.png)
![The "Build & Deploy PR Docs / Build & Upload Artifact" check is highlighted](../../../_static/images/doc-ci-1.png)

2. Click on **Summary** on the top left corner:

![Summary link in the "Build & Deploy PR Docs / Build & Uplod Artifact" GitHub Action page](images/doc-ci-2.png)
![Summary link in the "Build & Deploy PR Docs / Build & Uplod Artifact" GitHub Action page](../../../_static/images/doc-ci-2.png)

3. Scroll down to **Artifacts** and click on **html** to download the built documentation:

!["html" link in the Artifacts section of the "Build & Deploy PR Docs / Build & Uplod Artifact" GitHub Action page is highlighted](images/doc-ci-3.png)
!["html" link in the Artifacts section of the "Build & Deploy PR Docs / Build & Uplod Artifact" GitHub Action page is highlighted](../../../_static/images/doc-ci-3.png)

4. Extract the compressed archive and open the `html/index.html` file on your preferred browser.
You can also use Python's `http.server` module to open a local server on
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ much as we can with unit tests, requiring fewer integration tests, and the least
of functional tests as depicted in the test pyramid below from
[softwaretestinghelp.com](https://www.softwaretestinghelp.com/the-difference-between-unit-integration-and-functional-testing/):

![Pyramid diagram depicting the relationship between time to write/execute three different types of tests and return on investment for those tests. The pyramid is split into three sections: the bottom, largest section is Unit testing, the middle section is Integration testing and the top is Functional testing. The size of the section is proportional to the quantity of tests of that type you should write. Moving up the pyramid, tests take longer to write and have a lower return on investment.](../../images/tests.png)
![Pyramid diagram depicting the relationship between time to write/execute three different types of tests and return on investment for those tests. The pyramid is split into three sections: the bottom, largest section is Unit testing, the middle section is Integration testing and the top is Functional testing. The size of the section is proportional to the quantity of tests of that type you should write. Moving up the pyramid, tests take longer to write and have a lower return on investment.](../../_static/images/tests.png)

Unit tests are at the base of the pyramid because they are the easiest to write and
the quickest to run. The time and effort to implement and maintain tests increases
Expand Down
12 changes: 6 additions & 6 deletions docs/developers/coredev/maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ The token should be named `GHA_TOKEN` and the required permissions are:
* **read and write** to pull requests
* **read and write** to code

![screenshot of token permissions in GitHub UI](../../images/update_token_permissions.png)
![screenshot of token permissions in GitHub UI](../../_static/images/update_token_permissions.png)

At the moment of writing this document, there is a difference in names between the summary of the token and the list of permissions.
The **code** permission is called **Contents** in the Edit view of the token.

![screenshot of token permissions](../../images/edit_token_permissions.png)
![screenshot of token permissions](../../_static/images/edit_token_permissions.png)

## Refreshing the token

To create a new token, go to the personal settings page and select _Developer settings_ at the bottom of the left menu. On the visible screen, expand the _Personal access tokens_ section and click the _Fine-grained token_ link.

![View on list of fine-grained tokens](../../images/fine_grained_token.png)
![View on list of fine-grained tokens](../../_static/images/fine_grained_token.png)

Then click the _Generate new token_ button in the upper right corner.

Expand All @@ -47,19 +47,19 @@ Fill the form:
4. Select **napari** to be the resource owner
5. Select _Only selected repositories_ and then select **napari/napari** repository

![screenshot of the token creation form](../../images/token_permission_form.png)
![screenshot of the token creation form](../../_static/images/token_permission_form.png)

6. Select the required permissions for repository metadata, pull requests, and code (contents)

![screenshot of the token creation form](../../images/token_permission_selection.png)
![screenshot of the token creation form](../../_static/images/token_permission_selection.png)

7. Click the _Generate token_ button
8. Copy token
9. Go to the napari repository settings
10. Expand the _Secrets and variables_ section and select _Actions_
11. Click the edit button for the `GHA_TOKEN` secret

![screenshot of the token creation form](../../images/secrets_section.png)
![screenshot of the token creation form](../../_static/images/secrets_section.png)

12. Paste a new token to the value field

Expand Down
5 changes: 5 additions & 0 deletions docs/developers/coredev/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ The main OS-agnostic keys are:

Then, depending on the operating systems and the installer format, we customize the configuration a bit more.

The bundled Python version in the installers follows the Python version installed in the CI
`make_bundle_conda.yml` workflow at `napari/packaging`. Update the CI matrix configuration to bump
the bundled Python. We use the oldest version supported by the [SPEC-0][SPEC0] recommendations.

#### Default installation path

This depends on each OS. Our general strategy is to put the general installation under
Expand Down Expand Up @@ -259,3 +263,4 @@ Generating a `conda`-based installer requires several components in place:
[21]: https://anaconda.org/conda-forge/napari
[22]: https://github.com/conda/constructor/blob/764ba8a/constructor/nsis/_nsis.py
[nap-2]: https://napari.org/dev/naps/2-conda-based-packaging.html
[SPEC0]: https://scientific-python.org/specs/spec-0000/
6 changes: 3 additions & 3 deletions docs/guides/3D_interactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
## Coordinate systems in napari
In napari, there are three main coordinate systems: (1) canvas, (2) world, and (3) layer. The canvas coordinates system is the 2D coordinate system of the canvas on which the scene is rendered. World coordinates are the nD coordinates of the entire scene. As the name suggests, layer coordinates are the nD coordinate system of the data in a given layer. Layer coordinates are specific to each layer's data and are related to the world coordinate system via the layer transforms.

![A diagram of the coordinate systems and components involved when interacting with layers in napari. The camera faces the 3D scene to generate a 2D image that is presented on the canvas.](images/3d_interaction_coordianates.png)
![A diagram of the coordinate systems and components involved when interacting with layers in napari. The camera faces the 3D scene to generate a 2D image that is presented on the canvas.](../_static/images/3d_interaction_coordianates.png)

## In 3D mode, clicks are lines
Since the 3D scene is rendered on a 2D surface (your screen), your mouse click does not map to a specific point in space. As the view is a [parallel projection](https://en.wikipedia.org/wiki/Parallel_projection), napari can determine a line through 3D space that intersects the canvas where the user clicked.

![A diagram that shows how clicking on a 2D position on the canvas corresponds to a 3D click line in the scene that starts from the 3D camera position.](images/3d_interaction_click_line.png)
![A diagram that shows how clicking on a 2D position on the canvas corresponds to a 3D click line in the scene that starts from the 3D camera position.](../_static/images/3d_interaction_click_line.png)

When a user clicks or moves the mouse in the canvas, napari emits a mouse event with the following properties:

Expand All @@ -25,7 +25,7 @@ When a user clicks or moves the mouse in the canvas, napari emits a mouse event
## Determining where the click intersects the data
Each napari layer has a method called `get_ray_intersections()` that will return the points on the data bounding box that a given line will intersect (`start_point ` and `end_point `). When the click line (`view_direction`) and position (`position`) are used as inputs, `start_point` and `end_point` are the end points of the segment click line that intersects the layer's axis-alinged data bounding box. `start_point` is the end point that is closest to the camera (i.e, the "first" intersection) and `end_point` is the end point that is farthest from the camera (i.e., the "last" intersection). You can use the line segment between `start_point` and `end_point` to interrogate the layer data that is "under" your cursor.

![A diagram that shows how the 3D click line starting from the camera position intersects with the 3D bounding box associated with a layer's data. There are two intersection points. A start point, which is the first intersection point, and the end point which is the second.](images/3d_interaction_ray_intersection.png)
![A diagram that shows how the 3D click line starting from the camera position intersects with the 3D bounding box associated with a layer's data. There are two intersection points. A start point, which is the first intersection point, and the end point which is the second.](../_static/images/3d_interaction_ray_intersection.png)

See the `get_ray_intersection()` docstrings below for details. Note that if the line does not intersect the data bounding box (i.e., the click was outside of the data), `start_point` and `end_point` are `None`. The `position` and `view_direction` should be provided as world coordinates if `world` is set to True and in layer coordinates if `world` is set to `False`.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/contexts_expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Out[15]: False
But unlike a simple string, they can also provide type hinting, linting
capabilities, and IDE autocompletion (for napari developers).

![An IDE showing a type hint for an attribute of the LayerListContextKeys class.](images/context_type_hint.png)
![An IDE showing a type hint for an attribute of the LayerListContextKeys class.](../_static/images/context_type_hint.png)

A record of all registered context keys can be retrieved with the class method
`ContextKey.info()`
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/event_loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ If you would like to create your own widgets in napari see {ref}`creating-widget
### napari's `QApplication`

In napari, the initial step of creating the `QApplication` is handled by
{func}`napari.qt.get_app`. (Note however, that napari will do this for you
{func}`napari.qt.get_qapp`. (Note however, that napari will do this for you
automatically behind the scenes when you create a viewer with
{class}`napari.Viewer()`)

Expand Down
8 changes: 4 additions & 4 deletions docs/guides/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ with the layer from the viewer. These modes are accessible via the layer control
widget top buttons and via keyboard shortcuts (these shortcuts will vary depending on the layer type). Currently, there are two base modes:

* Pan and zoom
![image: Pan/zoom](../images/pan-zoom-tool.png)
![image: Pan/zoom](../_static/images/pan-zoom-tool.png)

The `pan_zoom` mode allows you to pan around and zoom in/out the layer. It's
the default mode selected. Note: zooming with the mouse-wheel should essentially always work!

* Transform
![image: Transform](../images/transform-tool.png)
![image: Transform](../_static/images/transform-tool.png)

The `transform` mode allows you to translate, rotate, and scale the layer
graphically. Note: While you can transform 3D layers, at present this mode is only usable in 2D viewer display mode.
Expand Down Expand Up @@ -106,7 +106,7 @@ other layers.

For example, the image below shows an image with the blending set to `additive`.

![napari viewer with an image of a cell. Layer controls are open in the left sidebar with the blending set to additive.](./images/blending.png)
![napari viewer with an image of a cell. Layer controls are open in the left sidebar with the blending set to additive.](../_static/images/blending.png)

## 3D rendering of images

Expand Down Expand Up @@ -154,7 +154,7 @@ distances from the camera according to a maximum intensity projection to create
the 2D image that is then displayed on the screen. This mode works well for many
biological images such as these cells growing in culture:

![napari viewer with an image of cells in a culture. Layer controls are open in the left sidebar and rendering set to mip.](./images/rendering.png)
![napari viewer with an image of cells in a culture. Layer controls are open in the left sidebar and rendering set to mip.](../_static/images/rendering.png)

When viewing 2D slices the rendering mode has no effect.

Expand Down
4 changes: 2 additions & 2 deletions docs/howtos/layers/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ sample image of your choice.

### Buttons

* `Pan/zoom` ![image: Pan/zoom tool](../../images/pan-zoom-tool.png) is the default mode
* `Pan/zoom` ![image: Pan/zoom tool](../../_static/images/pan-zoom-tool.png) is the default mode
of the layer and supports panning and zooming. Press the `1` key when the layer is selected
to use this mode.

* `Transform` ![image: Transform](../../images/transform-tool.png) enables you to
* `Transform` ![image: Transform](../../_static/images/transform-tool.png) enables you to
rotate, scale, or translate the layer. Note: at present this feature is limited to 2D viewer display mode.
To reset the transformation,
you can Option/Alt-click the transform button (a confirmation dialog will open to
Expand Down
Loading

0 comments on commit d58ba17

Please sign in to comment.