283375 a9d7681ee7
refactor: moving ui.extends to core
* Settings and Singletons moved
2024-06-20 21:30:21 +08:00

19 lines
374 B
Python

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