Bug while Drag n' Drop from LibraryTree without selection fixed
authorgreg
Wed, 03 Jun 2009 12:47:21 +0200
changeset 366 764a7584022c
parent 365 7bfd014652e0
child 367 2fdf57d0ce51
Bug while Drag n' Drop from LibraryTree without selection fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Wed Jun 03 10:37:49 2009 +0200
+++ b/PLCOpenEditor.py	Wed Jun 03 12:47:21 2009 +0200
@@ -2110,7 +2110,7 @@
     def OnLibraryTreeItemSelected(self, event):
         selected = event.GetItem()
         pydata = self.LibraryTree.GetPyData(selected)
-        if pydata["type"] != CATEGORY:
+        if pydata is not None and pydata["type"] != CATEGORY:
             blocktype = self.Controler.GetBlockType(self.LibraryTree.GetItemText(selected), pydata["inputs"], debug = self.Debug)
             if blocktype:
                 self.LibraryComment.SetValue(blocktype["comment"])
@@ -2123,7 +2123,7 @@
     def OnLibraryTreeBeginDrag(self, event):
         selected = event.GetItem()
         pydata = self.LibraryTree.GetPyData(selected)
-        if selected is not None and pydata["type"] == BLOCK:
+        if pydata is not None and pydata["type"] == BLOCK:
             data = wx.TextDataObject(str((self.LibraryTree.GetItemText(selected), 
                 pydata["block_type"], "", pydata["inputs"])))
             dragSource = wx.DropSource(self.LibraryTree)