Clean up new tactical mode stats stuff
This commit is contained in:
@@ -53,8 +53,3 @@ class Mode(ItemAttrShortcut, HandledItem):
|
|||||||
for effect in self.item.effects.itervalues():
|
for effect in self.item.effects.itervalues():
|
||||||
if effect.runTime == runTime and effect.activeByDefault:
|
if effect.runTime == runTime and effect.activeByDefault:
|
||||||
effect.handler(fit, self, context=("module",))
|
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
|
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ class ItemRemove(ContextMenu):
|
|||||||
"boosterItem", "projectedModule",
|
"boosterItem", "projectedModule",
|
||||||
"projectedCharge", "cargoItem",
|
"projectedCharge", "cargoItem",
|
||||||
"projectedFit", "projectedDrone",
|
"projectedFit", "projectedDrone",
|
||||||
"fighterItem", "projectedFighter",
|
"fighterItem", "projectedFighter")
|
||||||
"fittingMode",)
|
|
||||||
|
|
||||||
def getText(self, itmContext, selection):
|
def getText(self, itmContext, selection):
|
||||||
return "Remove {0}".format(itmContext if itmContext is not None else "Item")
|
return "Remove {0}".format(itmContext if itmContext is not None else "Item")
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import gui.display as d
|
|||||||
from gui.contextMenu import ContextMenu
|
from gui.contextMenu import ContextMenu
|
||||||
import gui.shipBrowser
|
import gui.shipBrowser
|
||||||
import gui.multiSwitch
|
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.builtinViewColumns.state import State
|
||||||
from gui.bitmapLoader import BitmapLoader
|
from gui.bitmapLoader import BitmapLoader
|
||||||
import gui.builtinViews.emptyView
|
import gui.builtinViews.emptyView
|
||||||
@@ -331,7 +331,7 @@ class FittingView(d.Display):
|
|||||||
|
|
||||||
def removeItem(self, event):
|
def removeItem(self, event):
|
||||||
row, _ = self.HitTest(event.Position)
|
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)
|
col = self.getColumn(event.Position)
|
||||||
if col != self.getColIndex(State):
|
if col != self.getColIndex(State):
|
||||||
self.removeModule(self.mods[row])
|
self.removeModule(self.mods[row])
|
||||||
@@ -342,12 +342,7 @@ class FittingView(d.Display):
|
|||||||
def removeModule(self, module):
|
def removeModule(self, module):
|
||||||
sFit = service.Fit.getInstance()
|
sFit = service.Fit.getInstance()
|
||||||
fit = sFit.getFit(self.activeFitID)
|
fit = sFit.getFit(self.activeFitID)
|
||||||
try:
|
populate = sFit.removeModule(self.activeFitID, fit.modules.index(module))
|
||||||
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
|
|
||||||
|
|
||||||
if populate is not None:
|
if populate is not None:
|
||||||
self.slotsChanged()
|
self.slotsChanged()
|
||||||
@@ -497,20 +492,17 @@ class FittingView(d.Display):
|
|||||||
mod = self.mods[self.GetItemData(sel)]
|
mod = self.mods[self.GetItemData(sel)]
|
||||||
|
|
||||||
# Test if this is a mode, which is a special snowflake of a Module
|
# 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"
|
srcContext = "fittingMode"
|
||||||
# Skip the normal processing
|
|
||||||
mod.isEmpty = True
|
|
||||||
|
|
||||||
itemContext = sMkt.getCategoryByItem(mod.item).name
|
itemContext = "Tactical Mode"
|
||||||
fullContext = (srcContext, itemContext)
|
fullContext = (srcContext, itemContext)
|
||||||
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts):
|
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts):
|
||||||
contexts.append(fullContext)
|
contexts.append(fullContext)
|
||||||
|
|
||||||
selection.append(mod)
|
selection.append(mod)
|
||||||
|
|
||||||
|
elif not mod.isEmpty:
|
||||||
if not mod.isEmpty:
|
|
||||||
srcContext = "fittingModule"
|
srcContext = "fittingModule"
|
||||||
itemContext = sMkt.getCategoryByItem(mod.item).name
|
itemContext = sMkt.getCategoryByItem(mod.item).name
|
||||||
fullContext = (srcContext, itemContext)
|
fullContext = (srcContext, itemContext)
|
||||||
|
|||||||
@@ -70,11 +70,6 @@ class ContextMenu(object):
|
|||||||
amount += 1
|
amount += 1
|
||||||
texts = m.getText(itemContext, selection)
|
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):
|
if isinstance(texts, basestring):
|
||||||
texts = (texts,)
|
texts = (texts,)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user