--- 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: