Bug when reopen files on Windows fixed
authorlbessard
Sun, 31 Aug 2008 18:41:07 +0200
changeset 245 fdd05081c966
parent 244 05f6e0d7710c
child 246 9cf9694e8d66
Bug when reopen files on Windows fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Thu Aug 28 14:32:42 2008 +0200
+++ b/PLCOpenEditor.py	Sun Aug 31 18:41:07 2008 +0200
@@ -1684,11 +1684,13 @@
     def RefreshLibraryTree(self):
         to_delete = []
         blocktypes = self.Controler.GetBlockTypes()
-        if wx.Platform == '__WXMSW__':
-            root = self.LibraryTree.AddRoot("Block Types")
-            self.LibraryTree.SetPyData(root, {"type" : CATEGORY})
-        else:
-            root = self.LibraryTree.AddRoot("")
+        root = self.LibraryTree.GetRootItem()
+        if not root.IsOk():
+            if wx.Platform == '__WXMSW__':
+                root = self.LibraryTree.AddRoot("Block Types")
+                self.LibraryTree.SetPyData(root, {"type" : CATEGORY})
+            else:
+                root = self.LibraryTree.AddRoot("")
         if wx.VERSION >= (2, 6, 0):
             category_item, root_cookie = self.LibraryTree.GetFirstChild(root)
         else: