Beremiz.py
changeset 490 898648a09e13
parent 466 11263fd24566
child 495 03e17cd5bde7
equal deleted inserted replaced
489:e3adb9f63171 490:898648a09e13
   407         if projectOpen is not None and os.path.isdir(projectOpen):
   407         if projectOpen is not None and os.path.isdir(projectOpen):
   408             self.PluginRoot = PluginsRoot(self, self.Log)
   408             self.PluginRoot = PluginsRoot(self, self.Log)
   409             self.Controler = self.PluginRoot
   409             self.Controler = self.PluginRoot
   410             result = self.PluginRoot.LoadProject(projectOpen, buildpath)
   410             result = self.PluginRoot.LoadProject(projectOpen, buildpath)
   411             if not result:
   411             if not result:
   412                 self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
       
   413                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
   412                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
   414                 self.RefreshAll()
   413                 self.RefreshAll()
   415             else:
   414             else:
   416                 self.ResetView()
   415                 self.ResetView()
   417                 self.ShowErrorMessage(result)
   416                 self.ShowErrorMessage(result)
   419             self.PluginRoot = plugin_root
   418             self.PluginRoot = plugin_root
   420             self.Controler = plugin_root
   419             self.Controler = plugin_root
   421             if plugin_root is not None:
   420             if plugin_root is not None:
   422                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
   421                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
   423                 self.RefreshAll()
   422                 self.RefreshAll()
       
   423         if self.EnableDebug:
       
   424             self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
       
   425                 
   424         
   426         
   425         # Add beremiz's icon in top left corner of the frame
   427         # Add beremiz's icon in top left corner of the frame
   426         self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
   428         self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
   427         
   429         
   428         self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
   430         self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
   514                 return False
   516                 return False
   515         return True
   517         return True
   516     
   518     
   517     def OnCloseFrame(self, event):
   519     def OnCloseFrame(self, event):
   518         if self.PluginRoot is None or self.CheckSaveBeforeClosing(_("Close Application")):
   520         if self.PluginRoot is None or self.CheckSaveBeforeClosing(_("Close Application")):
       
   521             self.PluginRoot.KillDebugThread()
   519             self.KillLocalRuntime()
   522             self.KillLocalRuntime()
   520             self.PluginRoot.KillDebugThread()
       
   521             event.Skip()
   523             event.Skip()
   522         else:
   524         else:
   523             event.Veto()
   525             event.Veto()
   524     
   526     
   525     def OnMoveWindow(self, event):
   527     def OnMoveWindow(self, event):
  1319         self.PluginInfos = {}
  1321         self.PluginInfos = {}
  1320         if self.PluginRoot is not None:
  1322         if self.PluginRoot is not None:
  1321             self.PluginRoot.CloseProject()
  1323             self.PluginRoot.CloseProject()
  1322         self.PluginRoot = None
  1324         self.PluginRoot = None
  1323         self.Log.flush()
  1325         self.Log.flush()
  1324         self.DebugVariablePanel.SetDataProducer(None)
  1326         if self.EnableDebug:
       
  1327             self.DebugVariablePanel.SetDataProducer(None)
  1325     
  1328     
  1326     def OnNewProjectMenu(self, event):
  1329     def OnNewProjectMenu(self, event):
  1327         if self.PluginRoot is not None and not self.CheckSaveBeforeClosing():
  1330         if self.PluginRoot is not None and not self.CheckSaveBeforeClosing():
  1328             return
  1331             return
  1329         
  1332         
  1341             self.ResetView()
  1344             self.ResetView()
  1342             self.PluginRoot = PluginsRoot(self, self.Log)
  1345             self.PluginRoot = PluginsRoot(self, self.Log)
  1343             self.Controler = self.PluginRoot
  1346             self.Controler = self.PluginRoot
  1344             result = self.PluginRoot.NewProject(projectpath)
  1347             result = self.PluginRoot.NewProject(projectpath)
  1345             if not result:
  1348             if not result:
  1346                 self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
  1349                 if self.EnableDebug:
       
  1350                     self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
  1347                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
  1351                 self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
  1348                 self.RefreshAll()
  1352                 self.RefreshAll()
  1349             else:
  1353             else:
  1350                 self.ResetView()
  1354                 self.ResetView()
  1351                 self.ShowErrorMessage(result)
  1355                 self.ShowErrorMessage(result)
  1369                 self.ResetView()
  1373                 self.ResetView()
  1370                 self.PluginRoot = PluginsRoot(self, self.Log)
  1374                 self.PluginRoot = PluginsRoot(self, self.Log)
  1371                 self.Controler = self.PluginRoot
  1375                 self.Controler = self.PluginRoot
  1372                 result = self.PluginRoot.LoadProject(projectpath)
  1376                 result = self.PluginRoot.LoadProject(projectpath)
  1373                 if not result:
  1377                 if not result:
  1374                     self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
  1378                     if self.EnableDebug:
       
  1379                         self.DebugVariablePanel.SetDataProducer(self.PluginRoot)
  1375                     self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
  1380                     self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
  1376                     self.RefreshAll()
  1381                     self.RefreshAll()
  1377                 else:
  1382                 else:
  1378                     self.ResetView()
  1383                     self.ResetView()
  1379                     self.ShowErrorMessage(result)
  1384                     self.ShowErrorMessage(result)