From ba038ca269764a6bd9aeccc65175299c8d7463d0 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Sat, 9 Oct 2010 01:25:12 +0300 Subject: [PATCH] Added icons to itemstats attributes --- gui/itemStats.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gui/itemStats.py b/gui/itemStats.py index 04d73800c..9f5831e96 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -236,6 +236,8 @@ class ItemParams (wx.Panel): self.paramList.InsertColumn(1,"Value") self.paramList.SetColumnWidth(1,100) self.paramList.setResizeColumn(1) + self.imageList = wx.ImageList(16, 16) + self.paramList.SetImageList(self.imageList,wx.IMAGE_LIST_SMALL) if self.stuff is None or self.stuff.item == self.item: attrs = self.stuff.itemModifiedAttributes if self.stuff is not None else self.item.attributes attrsInfo = self.item.attributes if self.stuff is None else self.stuff.item.attributes @@ -258,7 +260,17 @@ class ItemParams (wx.Panel): else: attrName = info.displayName if info else name - index = self.paramList.InsertStringItem(sys.maxint, attrName) + if info: + if info.icon is not None: + iconFile = info.icon.iconFile + attrIcon = self.imageList.Add(bitmapLoader.getBitmap(iconFile, "pack")) + else: + attrIcon = self.imageList.Add(bitmapLoader.getBitmap("07_15", "pack")) + else: + attrIcon = self.imageList.Add(bitmapLoader.getBitmap("07_15", "pack")) + + + index = self.paramList.InsertImageStringItem(sys.maxint, attrName,attrIcon) idNameMap[idCount] = attrName self.paramList.SetItemData(index, idCount) idCount += 1 @@ -270,6 +282,7 @@ class ItemParams (wx.Panel): else: valueUnit = formatAmount(value, 3, 0, 0) + self.paramList.SetStringItem(index, 1, valueUnit)