mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
refactor: moving ui.extends
to core
* Settings and Singletons moved
This commit is contained in:
18
core/singleton.py
Normal file
18
core/singleton.py
Normal 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
|
Reference in New Issue
Block a user