spacr.qt.widgets.percentile_pair

Two numeric fields for the low and high ends of a percentile window.

A PERCENTILE WINDOW IS TWO NUMBERS, so it is asked for as two numbers. Typed into one box it is a small parsing problem handed to the user: [1, 99] and [1 99] are the same intent and only one of them used to survive the trip to the renderer, and the user found out by getting a picture that was not the one they asked for rather than by being told.

The STORED value does not change. PercentilePair.value() answers the [low, high] list every settings file already holds, and spacr.picture_settings.percentile_pair() reads both that and every text spelling that reached disk before this control existed – so an old settings CSV opens on the pair it recorded instead of being refused.

Classes

PercentilePair

The low and high ends of a percentile window, as two spin boxes.

Module Contents

class spacr.qt.widgets.percentile_pair.PercentilePair(value: Any = None, parent: PySide6.QtWidgets.QWidget | None = None)[source]

Bases: PySide6.QtWidgets.QWidget

The low and high ends of a percentile window, as two spin boxes.

The two fields constrain each other rather than validating after the fact: the high field cannot go below the low one and the low field cannot go above the high one, so an inverted window is not a value the panel can be left holding.

Build the pair.

Parameters:
  • value – the starting window, in any spelling spacr.picture_settings.percentile_pair() accepts.

  • parent – the owning widget.

high() → PySide6.QtWidgets.QDoubleSpinBox[source]

The field holding the high end.

low() → PySide6.QtWidgets.QDoubleSpinBox[source]

The field holding the low end.

setText(value: Any) → None[source]

Set both percentiles from one settings string.

Named for QLineEdit’s method for the same reason as ChannelPicker.setText().

Parameters:

value – the pair, as the settings dict spells it.

set_value(value: Any) → None[source]

Apply a window and announce it once.

Parameters:

value – any spelling spacr.picture_settings.percentile_pair() accepts, including the bracketed text a settings file written before this control existed still holds.

text() → str[source]

The window as "low, high", for readers that want text.

value() → List[Any][source]

The window as [low, high], in the form settings files hold.