From 8f9a95db937ee2b82695ceab27a7bd33d3b557fb Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 2 May 2019 16:10:22 +0300 Subject: [PATCH] Do not crash when icons are missing, and add ADC mutaplasmid override --- gui/bitmap_loader.py | 5 ++++- gui/builtinItemStatsViews/itemMutator.py | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gui/bitmap_loader.py b/gui/bitmap_loader.py index 09591b32a..bbc31bbb2 100644 --- a/gui/bitmap_loader.py +++ b/gui/bitmap_loader.py @@ -50,8 +50,11 @@ class BitmapLoader(object): @classmethod def getStaticBitmap(cls, name, parent, location): + bitmap = cls.getBitmap(name or 0, location) + if bitmap is None: + return None static = wx.StaticBitmap(parent) - static.SetBitmap(cls.getBitmap(name or 0, location)) + static.SetBitmap(bitmap) return static @classmethod diff --git a/gui/builtinItemStatsViews/itemMutator.py b/gui/builtinItemStatsViews/itemMutator.py index 8006f5c6f..1c97d5be5 100644 --- a/gui/builtinItemStatsViews/itemMutator.py +++ b/gui/builtinItemStatsViews/itemMutator.py @@ -26,8 +26,12 @@ class ItemMutatorPanel(wx.Panel): headerSizer = wx.BoxSizer(wx.HORIZONTAL) headerSizer.AddStretchSpacer() - headerSizer.Add(BitmapLoader.getStaticBitmap(mod.item.iconID, self, "icons"), 0, 0, 0) - headerSizer.Add(BitmapLoader.getStaticBitmap(mod.mutaplasmid.item.iconID, self, "icons"), 0, wx.LEFT, 0) + itemIcon = BitmapLoader.getStaticBitmap(mod.item.iconID, self, "icons") + if itemIcon is not None: + headerSizer.Add(itemIcon, 0, 0, 0) + mutaIcon = BitmapLoader.getStaticBitmap(mod.mutaplasmid.item.iconID, self, "icons") + if mutaIcon is not None: + headerSizer.Add(mutaIcon, 0, wx.LEFT, 0) sourceItemShort = "{} {}".format(mod.mutaplasmid.item.name.split(" ")[0], mod.baseItem.name) sourceItemText = wx.StaticText(self, wx.ID_ANY, sourceItemShort) font = parent.GetFont() @@ -81,6 +85,7 @@ class ItemMutatorList(wx.ScrolledWindow): self.event_mapping = {} higOverrides = { ('Stasis Web', 'speedFactor'): False, + ('Damage Control', 'duration'): True, } first = True