Beremiz.py
changeset 490 898648a09e13
parent 466 11263fd24566
child 495 03e17cd5bde7
--- a/Beremiz.py	Wed Dec 09 16:46:59 2009 +0100
+++ b/Beremiz.py	Wed Dec 09 16:51:22 2009 +0100
@@ -409,7 +409,6 @@
             self.Controler = self.PluginRoot
             result = self.PluginRoot.LoadProject(projectOpen, buildpath)
             if not result:
-                self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
                 self.RefreshAll()
             else:
@@ -421,6 +420,9 @@
             if plugin_root is not None:
                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
                 self.RefreshAll()
+        if self.EnableDebug:
+            self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
+                
         
         # Add beremiz's icon in top left corner of the frame
         self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
@@ -516,8 +518,8 @@
     
     def OnCloseFrame(self, event):
         if self.PluginRoot is None or self.CheckSaveBeforeClosing(_("Close Application")):
+            self.PluginRoot.KillDebugThread()
             self.KillLocalRuntime()
-            self.PluginRoot.KillDebugThread()
             event.Skip()
         else:
             event.Veto()
@@ -1321,7 +1323,8 @@
             self.PluginRoot.CloseProject()
         self.PluginRoot = None
         self.Log.flush()
-        self.DebugVariablePanel.SetDataProducer(None)
+        if self.EnableDebug:
+            self.DebugVariablePanel.SetDataProducer(None)
     
     def OnNewProjectMenu(self, event):
         if self.PluginRoot is not None and not self.CheckSaveBeforeClosing():
@@ -1343,7 +1346,8 @@
             self.Controler = self.PluginRoot
             result = self.PluginRoot.NewProject(projectpath)
             if not result:
-                self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
+                if self.EnableDebug:
+                    self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
                 self.RefreshAll()
             else:
@@ -1371,7 +1375,8 @@
                 self.Controler = self.PluginRoot
                 result = self.PluginRoot.LoadProject(projectpath)
                 if not result:
-                    self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
+                    if self.EnableDebug:
+                        self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
                     self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
                     self.RefreshAll()
                 else: