From 3979413a1d4f721fb3a465d9dceb3425f92a1884 Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Tue, 7 Dec 2010 13:34:14 +0200 Subject: [PATCH] Optimized CachingImageList Add method --- gui/cachingImageList.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gui/cachingImageList.py b/gui/cachingImageList.py index d0549090c..28a195352 100644 --- a/gui/cachingImageList.py +++ b/gui/cachingImageList.py @@ -26,14 +26,10 @@ class CachingImageList(wx.ImageList): self.map = {} def Add(self, *loaderArgs): - key = "".join(loaderArgs) - if key not in self.map: + id = self.map.get(loaderArgs) + if id is None: bitmap = bitmapLoader.getBitmap(*loaderArgs) if bitmap is None: return -1 - id = wx.ImageList.Add(self,bitmap) - self.map[key] = id - else: - id = self.map[key] - + id = self.map[loaderArgs] = wx.ImageList.Add(self,bitmap) return id