spacr.qt.widgets.picture_settings_dialog

Picture-rendering controls shared by cell and image views.

Defaults come from spacr.settings.set_annotate_default_settings(), and mode applicability comes from spacr.picture_settings. The dialog thus uses the same values and availability rules as non-GUI callers.

Classes

PictureSettingsDialog

Edit picture settings while retaining mode-inapplicable values.

Functions

picture_defaults(→ Dict[str, Any])

Return typed defaults for every setting offered by the dialog.

Module Contents

class spacr.qt.widgets.picture_settings_dialog.PictureSettingsDialog(values: Dict[str, Any] | None = None, mode: str = 'png', parent: PySide6.QtWidgets.QWidget | None = None, *, source: Any = None, objects: Any = None)[source]

Bases: PySide6.QtWidgets.QDialog

Edit picture settings while retaining mode-inapplicable values.

Parameters:
  • values – the settings to open with. Keys outside the picture vocabulary are IGNORED rather than carried, and keys the dialog knows but the current mode does not apply are kept untouched – which is what “retaining” in the summary above means, and why editing PNG settings does not silently drop the array ones.

  • mode – which crop SOURCE the pictures come from. It decides which settings apply – a plane index means something to the array route and nothing to the database route, which finds its rows by coordinate columns – so an inapplicable setting is greyed with a reason rather than hidden.

  • parent – parent widget.

  • source – where the pictures come from, for the previews.

  • objects – the objects available to crop, for the previews.

Build the dialog controlling how object crops are drawn.

The cap label’s help is kept without its cost sentence, so re-stating the cost replaces it rather than stacking another copy on the end.

Parameters:
  • values – the settings to open with; missing keys fall back to the shipped picture defaults.

  • mode – which output the settings are for.

  • parent – parent widget, or None.

  • source – the data source, used to gate what this mode can offer.

  • objects – the object types available, for the per-object controls.

applied_values() → Dict[str, Any][source]

Only the settings the current mode actually uses.

mode() → str[source]

Which picture mode the user chose.

Returns:

the mode’s name.

set_mode(mode: str) → None[source]

Update control availability for an image-source mode.

Inapplicable controls remain visible and explain why they are disabled, so switching modes does not hide or discard configured values.

Parameters:

mode – image-source mode; each control is enabled or disabled by spacr.picture_settings.applies_to() for it, and an empty value means "png".

show_tab(title: str) → bool[source]

Bring the tab named title to the front. False if there is none.

A caller that wants one question answered can open the panel on it rather than on whichever tab happened to be first.

Parameters:

title – tab title, converted with str() and matched exactly.

tab_of(key: str) → str[source]

Which tab key’s control is on, or "" if it has none.

Parameters:

key – picture-setting key; converted with str() and stripped, and None counts as empty.

tab_titles() → tuple[source]

The tabs, in the order they are shown.

values() → Dict[str, Any][source]

Return every configured value, including disabled controls.

Values for the current mode’s disabled controls are preserved so that switching away from a mode and back restores the prior configuration.

spacr.qt.widgets.picture_settings_dialog.picture_defaults() → Dict[str, Any][source]

Return typed defaults for every setting offered by the dialog.