Add ability to look at tactical mode item info.

This commit is contained in:
Ebag333
2016-12-08 13:12:15 -08:00
parent 545c48266c
commit f5776a0cb2
2 changed files with 25 additions and 3 deletions

View File

@@ -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

View File

@@ -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