Beremiz.py
changeset 1441 826730e60407
parent 1408 eb2aa27602b7
child 1442 ad9a7853dea2
--- a/Beremiz.py	Sun Feb 08 16:50:54 2015 +0100
+++ b/Beremiz.py	Sun Feb 08 22:39:17 2015 +0100
@@ -36,6 +36,7 @@
 
 CWD = os.path.split(os.path.realpath(__file__))[0]
 
+
 def Bpath(*args):
     return os.path.join(CWD,*args)
 
@@ -634,6 +635,14 @@
         else:
             return IDEFrame.LoadTab(self, notebook, page_infos)
 
+    # Strange hack required by WAMP connector, using twisted.
+    # Twisted reactor needs to be stopped only before quit,
+    # since it cannot be restarted
+    ToDoBeforeQuit = []
+    def AddToDoBeforeQuit(self, Thing):
+        self.ToDoBeforeQuit.append(Thing)
+        print self.ToDoBeforeQuit
+
     def OnCloseFrame(self, event):
         for evt_type in [wx.EVT_SET_FOCUS,
                          wx.EVT_KILL_FOCUS,
@@ -646,6 +655,10 @@
 
             self.SaveLastState()
 
+            for Thing in self.ToDoBeforeQuit :
+                Thing()
+            self.ToDoBeforeQuit = []
+
             event.Skip()
         else:
             event.Veto()