refactor: moving ui.extends to core

* Settings and Singletons moved
This commit is contained in:
2024-06-20 21:30:21 +08:00
parent 4e7d54fbef
commit c664ed7e8d
20 changed files with 188 additions and 216 deletions

18
core/singleton.py Normal file
View File

@ -0,0 +1,18 @@
from typing import Generic, TypeVar
from PySide6.QtCore import QObject
T = TypeVar("T")
class Singleton(type, Generic[T]):
_instance = None
def __call__(cls, *args, **kwargs) -> T:
if cls._instance is None:
cls._instance = super().__call__(*args, **kwargs)
return cls._instance
class QSingleton(type(QObject), Singleton):
pass