43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
||
# gui/__init__.py
|
||
|
||
from __future__ import annotations
|
||
|
||
from .styles import APP_STYLES
|
||
from .components.button import Button
|
||
from .components.label import Label
|
||
|
||
|
||
def __getattr__(name: str):
|
||
"""Лениво отдать `MainWindow`, не создавая цикл `gui -> window -> hub -> gui`."""
|
||
if name == "MainWindow":
|
||
from .window import MainWindow
|
||
|
||
return MainWindow
|
||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||
|
||
__all__ = [
|
||
'MainWindow',
|
||
'APP_STYLES',
|
||
'Button',
|
||
'Label',
|
||
]
|
||
|
||
|
||
# ---------------------------------------------------------------------------
|
||
# Module workflow notes
|
||
# ---------------------------------------------------------------------------
|
||
#
|
||
# 1) Назначение модуля:
|
||
# Пакетный __init__.py для gui/. Реэкспортирует ключевые классы
|
||
# для удобного импорта: MainWindow, APP_STYLES, Button, Label.
|
||
#
|
||
# 2) Зависимости модуля:
|
||
# Реимпорт из: styles (APP_STYLES), components.button (Button),
|
||
# components.label (Label). MainWindow импортируется лениво через
|
||
# __getattr__, чтобы не создавать цикл с hub во время plugin-import.
|
||
#
|
||
# 3) Экспорт (__all__):
|
||
# MainWindow, Button, Label.
|
||
# Также доступен APP_STYLES (не в __all__, но импортируется).
|