Add Dispatch_V0.1.1
This commit is contained in:
48
Dispatch_V0.1.1/gui/theme_bus.py
Normal file
48
Dispatch_V0.1.1/gui/theme_bus.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# gui/theme_bus.py
|
||||
|
||||
from PySide6.QtCore import QObject, Signal
|
||||
|
||||
class ThemeBus(QObject):
|
||||
theme_changed = Signal(str) # "dark" | "light"
|
||||
|
||||
theme_bus = ThemeBus()
|
||||
|
||||
|
||||
# для использования снаружи:
|
||||
# theme_bus.theme_changed.emit("light")
|
||||
# theme_bus.theme_changed.emit("dark")
|
||||
|
||||
|
||||
# Подключение снаружи:
|
||||
# from gui.theme.theme_bus import ThemeBus
|
||||
# from gui.theme.theme_bus import theme_bus
|
||||
|
||||
# theme_bus = ThemeBus()
|
||||
|
||||
# btn = Button("Склад", index=0, theme_source=theme_bus)
|
||||
|
||||
# theme_bus.theme_changed.emit("light")
|
||||
# theme_bus.theme_changed.emit("dark")
|
||||
|
||||
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Module workflow notes (compact)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# 1) Назначение модуля:
|
||||
# Глобальная шина событий для переключения темы (dark/light).
|
||||
# Содержит QObject-синглтон theme_bus с сигналом theme_changed(str).
|
||||
# Все StylableMixin-виджеты подписаны на этот сигнал.
|
||||
#
|
||||
# 2) Зависимости модуля:
|
||||
# Импорты: QObject, Signal (PySide6.QtCore)
|
||||
# Хост/базовый класс: QObject
|
||||
# Внешние библиотеки: PySide6
|
||||
#
|
||||
# 3) Экспорт:
|
||||
# Класс ThemeBus — QObject с сигналом theme_changed: Signal(str).
|
||||
# Экземпляр theme_bus — глобальный синглтон.
|
||||
# Использование: theme_bus.theme_changed.emit("light"|"dark").
|
||||
Reference in New Issue
Block a user