spacr.qt.preferences_navigation

Open the Preferences dialog on one tab, at one row.

A preference result in the Help search field has to land on the row the user asked for, and the dialog it lands in is built by seven thousand lines of procedure with no schema to address. So this module navigates the BUILT dialog, by the two handles the build leaves behind:

  • every page sets an object name – PreferencesTabGeneral, PreferencesTabAnimation – and those names are what tools/build_help_search_index.py reads out of the same source, so the index and the dialog agree by construction rather than by a second list;

  • every row’s caption goes through spacr.qt.i18n.tr(), so the English in the index is turned into the displayed caption the same way the dialog turned it, and a Korean interface is matched as well as an English one.

Matching the DISPLAYED caption against an English literal was the version before this one, and it worked in exactly one language.

Kept out of preferences.py on purpose: that module is imported headless, and everything here needs live widgets.

Functions

page_named(→ Optional[PySide6.QtWidgets.QWidget])

The page whose object name is object_name.

reveal_row(→ bool)

Scroll to the row captioned label and outline it.

row_field(→ Optional[PySide6.QtWidgets.QWidget])

The field widget of the row captioned label.

show_tab(→ bool)

Bring the page named object_name to the front, at row label.

tab_widget(→ Optional[PySide6.QtWidgets.QTabWidget])

The dialog's tab bar.

Module Contents

spacr.qt.preferences_navigation.page_named(dialog: PySide6.QtWidgets.QWidget, object_name: str) → PySide6.QtWidgets.QWidget | None[source]

The page whose object name is object_name.

Parameters:
  • dialog – the preferences dialog.

  • object_name – e.g. "PreferencesTabTheme".

Returns:

the page widget, or None.

spacr.qt.preferences_navigation.reveal_row(page: PySide6.QtWidgets.QWidget, label: str) → bool[source]

Scroll to the row captioned label and outline it.

A STATIC outline for a few seconds rather than anything that moves: a mark that pulses would owe an answer to the Animation preferences, and this one owes none and is not lost on a reader who turned motion off.

Parameters:
  • page – the preferences page.

  • label – the English caption.

Returns:

True when the row was found.

spacr.qt.preferences_navigation.row_field(page: PySide6.QtWidgets.QWidget, label: str) → PySide6.QtWidgets.QWidget | None[source]

The field widget of the row captioned label.

Parameters:
  • page – the preferences page.

  • label – the English caption.

Returns:

the field widget, or None when no row carries that caption.

spacr.qt.preferences_navigation.show_tab(dialog: PySide6.QtWidgets.QWidget, object_name: str, label: str = '') → bool[source]

Bring the page named object_name to the front, at row label.

Parameters:
  • dialog – the preferences dialog, already built.

  • object_name – the page’s object name.

  • label – the English caption of the row to mark; "" marks none.

Returns:

True when the page was found and shown.

spacr.qt.preferences_navigation.tab_widget(dialog: PySide6.QtWidgets.QWidget) → PySide6.QtWidgets.QTabWidget | None[source]

The dialog’s tab bar.

Parameters:

dialog – the preferences dialog.

Returns:

the QTabWidget, or None.

Nested helpers

reveal_row._unmark() → None

Put the row back the way it was found.

spacr/qt/preferences_navigation.py:187