diff --git a/eos/saveddata/mode.py b/eos/saveddata/mode.py index 2b3108a9d..d505807b9 100644 --- a/eos/saveddata/mode.py +++ b/eos/saveddata/mode.py @@ -53,3 +53,8 @@ class Mode(ItemAttrShortcut, HandledItem): for effect in self.item.effects.itervalues(): if effect.runTime == runTime and effect.activeByDefault: effect.handler(fit, self, context=("module",)) + + def getValidCharges(self): + # Modes don't have charges, but it is queried for so return nothing. + validCharges = set() + return validCharges diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 348562e24..c047d9844 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -339,7 +339,11 @@ class FittingView(d.Display): def removeModule(self, module): sFit = service.Fit.getInstance() fit = sFit.getFit(self.activeFitID) - populate = sFit.removeModule(self.activeFitID, fit.modules.index(module)) + try: + populate = sFit.removeModule(self.activeFitID, fit.modules.index(module)) + except ValueError: + # This module isn't in our list of modules, don't remove anything. Likely a special snowflake. + populate = None if populate is not None: self.slotsChanged() @@ -441,12 +445,11 @@ class FittingView(d.Display): if fit.mode: # Modes are special snowflakes and need a little manual loving # We basically append the Mode rack and Mode to the modules - # while also marking their positions in the Blanks list + # while also marking the mode header position in the Blanks list if sFit.serviceFittingOptions["rackSlots"]: self.blanks.append(len(self.mods)) self.mods.append(Rack.buildRack(Slot.MODE)) - self.blanks.append(len(self.mods)) self.mods.append(fit.mode) else: self.mods = None @@ -488,12 +491,26 @@ class FittingView(d.Display): while sel != -1 and sel not in self.blanks: mod = self.mods[self.GetItemData(sel)] + + # Test if mod.isEmpty exists. + try: + mod.isEmpty + except AttributeError: + mod.isEmpty = False + if not mod.isEmpty: srcContext = "fittingModule" itemContext = sMkt.getCategoryByItem(mod.item).name fullContext = (srcContext, itemContext) if not srcContext in tuple(fCtxt[0] for fCtxt in contexts): contexts.append(fullContext) + + # Test if mod.charge exists + try: + mod.charge + except AttributeError: + mod.charge = None + if mod.charge is not None: srcContext = "fittingCharge" itemContext = sMkt.getCategoryByItem(mod.charge).name