stopped() checks if stop_event object is None.

In case the events thread was not initiated.
This commit is contained in:
onyx-and-iris 2023-08-05 13:02:04 +01:00
parent 6bfd18c1ac
commit 0ee3a223ec

View File

@ -33,8 +33,7 @@ class Remote(CBindings):
{k: kwargs.pop(k) for k in ("pdirty", "mdirty", "midi", "ldirty")} {k: kwargs.pop(k) for k in ("pdirty", "mdirty", "midi", "ldirty")}
) )
self.gui = VmGui() self.gui = VmGui()
self.stop_event = threading.Event() self.stop_event = None
self.stop_event.clear()
self.logger = logger.getChild(self.__class__.__name__) self.logger = logger.getChild(self.__class__.__name__)
for attr, val in kwargs.items(): for attr, val in kwargs.items():
@ -57,6 +56,8 @@ class Remote(CBindings):
self.event.info() self.event.info()
self.logger.debug("initiating events thread") self.logger.debug("initiating events thread")
self.stop_event = threading.Event()
self.stop_event.clear()
queue = Queue() queue = Queue()
self.updater = Updater(self, queue) self.updater = Updater(self, queue)
self.updater.start() self.updater.start()
@ -64,7 +65,7 @@ class Remote(CBindings):
self.producer.start() self.producer.start()
def stopped(self): def stopped(self):
return self.stop_event.is_set() return self.stop_event is None or self.stop_event.is_set()
def login(self) -> None: def login(self) -> None:
"""Login to the API, initialize dirty parameters""" """Login to the API, initialize dirty parameters"""