Skip to content

Commit 10aac42

Browse files
committed
basic singleton-type functionality for demoboard (not enforced)
1 parent fa3c2f5 commit 10aac42

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/ttboard/demoboard.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ class DemoBoard:
4949
5050
5151
'''
52+
53+
_DemoBoardSingleton_Instance = None
54+
55+
@classmethod
56+
def get(cls):
57+
if cls._DemoBoardSingleton_Instance is None:
58+
cls._DemoBoardSingleton_Instance = cls()
59+
60+
return cls._DemoBoardSingleton_Instance
61+
62+
63+
64+
65+
5266
def __init__(self,
5367
mode:int=None,
5468
iniFile:str='config.ini',
@@ -102,6 +116,10 @@ def __init__(self,
102116
self.shuttle.get(self.user_config.default_project).enable()
103117
else:
104118
log.warn(f'Default project is unknown "{self.user_config.default_project}"')
119+
120+
if DemoBoard._DemoBoardSingleton_Instance is None:
121+
DemoBoard._DemoBoardSingleton_Instance = self
122+
105123

106124
@property
107125
def mode(self):

0 commit comments

Comments
 (0)