mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 21:15:56 +08:00
Document singleton
Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
parent
ec26579473
commit
f461ed0f5f
@ -39,7 +39,18 @@ class ExtruderManager(QObject):
|
|||||||
except KeyError: #Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong.
|
except KeyError: #Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong.
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
## The instance of the singleton pattern.
|
||||||
|
#
|
||||||
|
# It's None if the extruder manager hasn't been created yet.
|
||||||
__instance = None
|
__instance = None
|
||||||
|
|
||||||
|
## Gets an instance of the extruder manager, or creates one if no instance
|
||||||
|
# exists yet.
|
||||||
|
#
|
||||||
|
# This is an implementation of singleton. If an extruder manager already
|
||||||
|
# exists, it is re-used.
|
||||||
|
#
|
||||||
|
# \return The extruder manager.
|
||||||
@classmethod
|
@classmethod
|
||||||
def getInstance(cls):
|
def getInstance(cls):
|
||||||
if not cls.__instance:
|
if not cls.__instance:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user