Fixed bug list of ConfNodes blocks not refreshed when a library was enable or disable
authorLaurent Bessard
Tue, 30 Apr 2013 09:49:52 +0200
changeset 1080 5ec20f56b1d2
parent 1079 6c8dfc4fc23b
child 1081 9789531bc57c
Fixed bug list of ConfNodes blocks not refreshed when a library was enable or disable
ProjectController.py
--- a/ProjectController.py	Tue Apr 30 00:33:09 2013 +0200
+++ b/ProjectController.py	Tue Apr 30 09:49:52 2013 +0200
@@ -214,24 +214,28 @@
     def SetParamsAttribute(self, path, value):
         if path.startswith("BeremizRoot.TargetType.") and self.BeremizRoot.getTargetType().getcontent() is None:
             self.BeremizRoot.setTargetType(self.GetTarget())
-        return ConfigTreeNode.SetParamsAttribute(self, path, value)
+        res = ConfigTreeNode.SetParamsAttribute(self, path, value)
+        if path.startswith("BeremizRoot.Libraries."):
+            wx.CallAfter(self.RefreshConfNodesBlockLists)
+        return res
         
     # helper func to check project path write permission
     def CheckProjectPathPerm(self, dosave=True):
         if CheckPathPerm(self.ProjectPath):
             return True
-        dialog = wx.MessageDialog(self.AppFrame, 
-                    _('You must have permission to work on the project\nWork on a project copy ?'),
-                    _('Error'), 
-                    wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
-        answer = dialog.ShowModal()
-        dialog.Destroy()
-        if answer == wx.ID_YES:
-            if self.SaveProjectAs():
-                self.AppFrame.RefreshTitle()
-                self.AppFrame.RefreshFileMenu()
-                self.AppFrame.RefreshPageTitles()
-                return True
+        if self.AppFrame is not None:
+            dialog = wx.MessageDialog(self.AppFrame, 
+                        _('You must have permission to work on the project\nWork on a project copy ?'),
+                        _('Error'), 
+                        wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+            answer = dialog.ShowModal()
+            dialog.Destroy()
+            if answer == wx.ID_YES:
+                if self.SaveProjectAs():
+                    self.AppFrame.RefreshTitle()
+                    self.AppFrame.RefreshFileMenu()
+                    self.AppFrame.RefreshPageTitles()
+                    return True
         return False
     
     def _getProjectFilesPath(self, project_path=None):