spacr.qt.widgets.flash

A brief accent flash, for controls whose action leaves no other trace.

Two controls need the same feedback: a click that produces no visible change cannot be told apart from a click that was not received. The console’s copy glyph writes to the clipboard, which is invisible; the figure queue’s clear control empties a list that may already look empty. Both flash to confirm the click.

It lives here rather than being written twice so both controls flash for the same duration.

The colour is not decided here. A flash is drawn differently by a painted glyph and by a text label, so each control paints itself and asks Flash.active() whether it is flashing. What is shared is the timing and the state machine, which is the part that must agree.

Classes

Flash

Tracks whether a widget is currently flashing, and repaints it.

Module Contents

class spacr.qt.widgets.flash.Flash(widget, duration_ms: int = FLASH_MS)[source]

Tracks whether a widget is currently flashing, and repaints it.

Owned by the widget, not inherited, so a control can flash without committing to a base class – the copy glyph is a QAbstractButton and the clear control is a QLabel.

Parameters:
  • widget – the widget to repaint when the flash starts and ends.

  • duration_ms – how long to stay lit; defaults to FLASH_MS.

Arm a one-shot highlight over a widget.

Parameters:
  • widget – the widget to flash.

  • duration_ms – how long the highlight lasts.

trigger() → None[source]

Light the mark and schedule it to go out.

Re-triggering while lit restarts the clock rather than stacking timers, so holding down a repeat-firing control does not leave the mark on for as long as the last timer happens to run.

property active: bool[source]

Whether the mark should be drawn right now.