mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-04 23:09:41 +01:00
extension as singleton
This commit is contained in:
@@ -26,7 +26,16 @@
|
||||
#
|
||||
|
||||
|
||||
class BaseExtension:
|
||||
class Singleton(type):
|
||||
_INSTANCE = None
|
||||
|
||||
def __call__(cls, *args, **kwargs):
|
||||
if not cls._INSTANCE:
|
||||
cls._INSTANCE = type.__call__(cls, *args, **kwargs)
|
||||
return cls._INSTANCE
|
||||
|
||||
|
||||
class BaseExtension(metaclass=Singleton):
|
||||
""" Base extension (plugin) class. """
|
||||
# The label that will be displayed in the "Tools" menu.
|
||||
LABEL = "Base extension"
|
||||
|
||||
Reference in New Issue
Block a user