spacr.qt.widgets.flash

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

WHY THIS IS SHARED. Two controls need the same feedback for the same reason, and the reason is not cosmetic: a click that produces no visible change is indistinguishable 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 need to say “that happened”.

It lives here rather than being written twice because a second copy is a second duration, and two controls that flash for different lengths read as a bug in whichever one you notice second.

The colour is deliberately 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, and neither should have to change what it is in order to blink.

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.