Browse Source

Event loop integration: make it safe to add input events from output event callback.

Joeri Exelmans 5 years ago
parent
commit
0863e16d07
2 changed files with 2 additions and 5 deletions
  1. 1 4
      examples/digitalwatch/DigitalWatchGUI.py
  2. 1 1
      src/sccd/realtime/eventloop.py

+ 1 - 4
examples/digitalwatch/DigitalWatchGUI.py

@@ -150,10 +150,7 @@ class DigitalWatchGUI_Controller:
     # Check if time = alarm set time
     def checkTime(self):
         if self.GUI.getTime()[0] == self.GUI.getAlarm()[0] and self.GUI.getTime()[1] == self.GUI.getAlarm()[1] and self.GUI.getTime()[2] == self.GUI.getAlarm()[2]:
-            # this method is called by the statechart during transition execution,
-            # do not send an event direcly to the statechart!
-            # do it later on, from tk's event loop, asap:
-            self.GUI.parent.after(0, self.alarm)
+            self.alarm()
             return True
         else:
             return False

+ 1 - 1
src/sccd/realtime/eventloop.py

@@ -70,4 +70,4 @@ class EventLoop:
     def interrupt(self):
         if self.scheduled:
             self.event_loop.cancel(self.scheduled)
-        self._wakeup()
+        self.event_loop.schedule(0, self._wakeup)