Fixed bug two icons displayed for POU category item in Project Tree when adding a second POU
--- a/IDEFrame.py Wed May 29 09:26:56 2013 +0200
+++ b/IDEFrame.py Wed May 29 09:42:25 2013 +0200
@@ -1465,6 +1465,7 @@
highlight_colours = self.Highlights.get(infos.get("tagname", None), (wx.WHITE, wx.BLACK))
self.ProjectTree.SetItemBackgroundColour(root, highlight_colours[0])
self.ProjectTree.SetItemTextColour(root, highlight_colours[1])
+ self.ProjectTree.SetItemExtraImage(root, None)
if infos["type"] == ITEM_POU:
self.ProjectTree.SetItemImage(root,
self.TreeImageDict[self.Controler.GetPouBodyType(infos["name"])])
--- a/controls/CustomTree.py Wed May 29 09:26:56 2013 +0200
+++ b/controls/CustomTree.py Wed May 29 09:42:25 2013 +0200
@@ -24,8 +24,9 @@
CT.GenericTreeItem._ExtraImage = None
def SetExtraImage(self, image):
- self._type = 1
+ self._type = (1 if image is not None else 0)
self._ExtraImage = image
+
CT.GenericTreeItem.SetExtraImage = SetExtraImage
_DefaultGetCurrentCheckedImage = CT.GenericTreeItem.GetCurrentCheckedImage
@@ -61,13 +62,15 @@
self.ExtraImages[image] = self._imageListCheck.Add(GetBitmap(image.upper()))
def SetItemExtraImage(self, item, bitmap):
+ dc = wx.ClientDC(self)
image = self.ExtraImages.get(bitmap)
if image is not None:
- dc = wx.ClientDC(self)
item.SetExtraImage(image)
- self.CalculateSize(item, dc)
- self.RefreshLine(item)
-
+ else:
+ item.SetExtraImage(None)
+ self.CalculateSize(item, dc)
+ self.RefreshLine(item)
+
def SetAddMenu(self, add_menu):
self.AddMenu = add_menu