Add Dispatch_V0.1.1

This commit is contained in:
2026-04-29 08:18:54 +04:00
commit a7ede6ded4
404 changed files with 39167 additions and 0 deletions

View 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").