polyfoammesh.gui.theme
Theme manager: applies the design system to a running QApplication.
- Three modes:
“light”: force light QSS
“dark”: force dark QSS
“system”: follow OS preference (recommended default)
- Usage:
from PySide6.QtWidgets import QApplication from polyfoammesh.gui.theme import apply_theme, set_theme_mode app = QApplication([]) set_theme_mode(“system”) # or “light” / “dark” apply_theme(app)
# later, in a settings dialog: set_theme_mode(“dark”) apply_theme(app)
The QSS strings are embedded in this module (not loaded from disk) so the bundled EXE has no external file dependencies.
Functions
|
Apply the current theme to app. |
Return the currently resolved mode ('light' or 'dark'). |
|
Return the user's requested mode ('light', 'dark', or 'system'). |
|
|
Convenience: set the requested mode without applying it yet. |
Classes
|
Singleton-style theme manager. |
- class polyfoammesh.gui.theme.ThemeManager(parent=None)[source]
Bases:
QObjectSingleton-style theme manager. Tracks current mode and broadcasts changes.
- Parameters:
parent (QObject | None)
- themeChanged
- staticMetaObject = PySide6.QtCore.QMetaObject("ThemeManager" inherits "QObject": Methods: #4 type=Signal, signature=themeChanged(QString), parameters=QString )
- polyfoammesh.gui.theme.apply_theme(app=None)[source]
Apply the current theme to app. Returns the resolved mode.
Idempotent: safe to call multiple times. Listens to system theme changes when the requested mode is ‘system’.
- Return type:
- Parameters:
app (QApplication | None)
- polyfoammesh.gui.theme.set_theme_mode(mode)[source]
Convenience: set the requested mode without applying it yet.