Clean up new tactical mode stats stuff

(cherry picked from commit c9bc234)
This commit is contained in:
blitzman
2016-12-09 23:04:51 -08:00
committed by Ebag333
parent 9cfa0748ac
commit 57edc32a4b
4 changed files with 7 additions and 26 deletions

View File

@@ -53,8 +53,3 @@ 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

@@ -15,8 +15,7 @@ class ItemRemove(ContextMenu):
"boosterItem", "projectedModule",
"projectedCharge", "cargoItem",
"projectedFit", "projectedDrone",
"fighterItem", "projectedFighter",
"fittingMode",)
"fighterItem", "projectedFighter")
def getText(self, itmContext, selection):
return "Remove {0}".format(itmContext if itmContext is not None else "Item")

View File

@@ -25,7 +25,7 @@ import gui.display as d
from gui.contextMenu import ContextMenu
import gui.shipBrowser
import gui.multiSwitch
from eos.types import Slot, Rack, Module
from eos.types import Slot, Rack, Module, Mode
from gui.builtinViewColumns.state import State
from gui.bitmapLoader import BitmapLoader
import gui.builtinViews.emptyView
@@ -336,7 +336,7 @@ class FittingView(d.Display):
def removeItem(self, event):
row, _ = self.HitTest(event.Position)
if row != -1 and row not in self.blanks:
if row != -1 and row not in self.blanks and isinstance(self.mods[row], Module):
col = self.getColumn(event.Position)
if col != self.getColIndex(State):
self.removeModule(self.mods[row])
@@ -347,12 +347,7 @@ class FittingView(d.Display):
def removeModule(self, module):
sFit = Fit.getInstance()
fit = sFit.getFit(self.activeFitID)
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.
logger.debug("Failed attempt to remove %s from fit" % module.item.name)
populate = None
populate = sFit.removeModule(self.activeFitID, fit.modules.index(module))
if populate is not None:
self.slotsChanged()
@@ -502,20 +497,17 @@ class FittingView(d.Display):
mod = self.mods[self.GetItemData(sel)]
# Test if this is a mode, which is a special snowflake of a Module
if hasattr(mod, "_Mode__item"):
if isinstance(mod, Mode):
srcContext = "fittingMode"
# Skip the normal processing
mod.isEmpty = True
itemContext = sMkt.getCategoryByItem(mod.item).name
itemContext = "Tactical Mode"
fullContext = (srcContext, itemContext)
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts):
contexts.append(fullContext)
selection.append(mod)
if not mod.isEmpty:
elif not mod.isEmpty:
srcContext = "fittingModule"
itemContext = sMkt.getCategoryByItem(mod.item).name
fullContext = (srcContext, itemContext)

View File

@@ -71,11 +71,6 @@ class ContextMenu(object):
amount += 1
texts = m.getText(itemContext, selection)
# Check the selected item to see if it has special reasons for not showing the menu item
if srcContext == "fittingMode" and texts == "Remove Module":
# Don't show remove for modes, these are special modules that cannot be removed
continue
if isinstance(texts, basestring):
texts = (texts,)