You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# References and Motivation
With 0.6.0 on the way, there have been _many_ changes to the UI from
0.5.6, especially when considering the years of napari development. Much
of these changes have been done by me, and in recognition of that, I
would like to update the current static images used throughout the docs
with dynamically generated ones, so that any future UI changes do not
require thorough updates of the docs. This PR was originally conceived
slightly before, and then [discussed at 2025-03-13/14 docs
meeting](https://hackmd.io/10DKrIMhREmk9sa_QRirlg#2025-03-1314); the
docs meeting concluded that this PR should be made quickly, merged, and
then checked for any flakiness (since it requires a merge) or appearance
issues in the auto-generation. Then, we can make specific updates to the
script (or new scripts) in order to improve visualization for various
places in the docs. These are presently designed as proof-of-principle
and change things as needed. Conceivably, this can also replace images
where we hide building up a napari viewer instance, only to take an
nbscreenshot. I believe this script method is considerably faster, but
does require a bit less intuitive of a setup compared to the screenshot
method. Overall, this takes less than 3 seconds to generate over 20
images. I'm aware that many of these are not currently needed in the
docs, but may provide inspiration and design principles, even for the
autogeneration, moving forward. We'll clean up what exactly is
autogenerated in follow-up PRs. In follow ups, we can also consider
adding unique stylings to Qt elements on the fly, such as making a
certain button of interest have a yellow border.
Useful current places:
1. [viewer
tutorial](https://napari.org/dev/tutorials/fundamentals/viewer.html#viewer-buttons)
buttons, popups (e.g. we just added grid popup and the buttons below are
already out of date),, anything with console, etc. quite a few static
images in here
2. [layers tutorial](https://napari.org/dev/guides/layers.html)
3. [quick
start](https://napari.org/dev/tutorials/fundamentals/quick_start.html).
console related images
4. [various buttons and images in how to each
layer](https://napari.org/dev/howtos/layers/image.html)
And in the future, because we can more quickly generate images, we can
conceivably use more focused images throughout the docs.
This will require doing something with doc merges as force-orphan to
prevent build up of repo size with changing binaries, though nicely,
these images are so far quite small in size (comparatively)
# Description
In one single file, our goal is to autogenerate various elements of the
UI; these are either initially gotten with `viewer.screenshot` of the
current viewer state, or in follow-ups as specific pixmaps of the
widgets (or a defined group of widgets). These pixmaps are defined by
dictionaries at the top of the file, making it easier to find and
contribute to an image of interest. It also serves as models for 'set
up' of different element types (popups, menus, other states)
These include:
1. single widget elements always visible in the UI
2. menus, and specific submenus
3. triggered popup widgets, like grid, roll, ndisplay
4. groups of widgets. these are my favorite, but will take the most
thought to define because it allows us to dynamically 'crop' the viewer
to areas of interest. Lovely!
The current implementation prioritizes speed, but may need to add some
QTimer / sleep events for CI, not sure.
# Autogenerated image examples
## Viewer and folder structure

## Single widgets

## Menus

## Popups

## Combined groups of widgets

# Original PR Description
This is _really_ a draft of trying to autogenerate images that we can
use throughout the docs. I think this would _also_ speed up doc
generation in certain areas with reusable doc images, so that
nbscreenshot would not need to be as frequent. Everything is getting
saved into `images/_autogenerated` and could be used elsewhere.
1. Tries to autogenerate grabbing and saving many parts of the viewer
using the attributes of the viewer
Needs:
1. Popups are not working right, sometimes they trigger, often its the
dims slider popup. I probably need to just directly call the button, but
I'm having a tough time figuring out where the buttons live.
6. I think the timing of things has me really confused. I think QTimer
is necessary to wait for things to popup, but I can't figure out why
these popups aren't working
7. Also sometimes the console popups and saves as a screenshot, other
times its just the thin dock area prior to the console popup.
Examples of what _should_ appear in autogenerated if CI does it the same
was as locally

---------
Co-authored-by: Melissa Weber Mendonça <[email protected]>
0 commit comments