spacr.qt.widgets.preview_refresh

A Refresh button for every live preview: read src again and reload.

The previews load their first field from src once, on their own. When the folder changes under the same path, or the automatic load picked nothing because the path was wrong at the time, the user needs a way to say “look again”. This is that button, one implementation for all of them, because each preview only differs in the name of its loader.

Functions

current_src(→ str)

The source path the screen's form holds right now.

install_refresh_button(...)

Add a Refresh button to a preview card's title row.

reload_from_src(→ bool)

Check the screen's src and reload panel from it.

Module Contents

spacr.qt.widgets.preview_refresh.current_src(screen: Any) → str[source]

The source path the screen’s form holds right now.

Parameters:

screen – the module screen.

Returns:

the path, or "".

spacr.qt.widgets.preview_refresh.install_refresh_button(screen: Any, card: Any, panel: Any, *, panel_getter: Callable[[], Any] | None = None) → PySide6.QtWidgets.QToolButton | None[source]

Add a Refresh button to a preview card’s title row.

Parameters:
  • screen – the module screen.

  • card – the preview’s Card.

  • panel – the preview panel it reloads.

  • panel_getter – asked for the panel at the click instead of panel, for a card whose panel is built the first time the card is shown and so does not exist when the button does.

Returns:

the button, or None when the card has no title row to take it.

spacr.qt.widgets.preview_refresh.reload_from_src(screen: Any, panel: Any) → bool[source]

Check the screen’s src and reload panel from it.

Parameters:
  • screen – the module screen whose form holds src.

  • panel – the preview panel to reload.

Returns:

whether a load was started.