Merge branch 'T3DRebalance' of https://github.com/Ebag333/Pyfa into Ebag333-T3DRebalance
This commit is contained in:
@@ -53,3 +53,8 @@ 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,7 +14,8 @@ 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")
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ class ItemStats(ContextMenu):
|
|||||||
"skillItem", "projectedModule",
|
"skillItem", "projectedModule",
|
||||||
"projectedDrone", "projectedCharge",
|
"projectedDrone", "projectedCharge",
|
||||||
"itemStats", "fighterItem",
|
"itemStats", "fighterItem",
|
||||||
"implantItemChar", "projectedFighter")
|
"implantItemChar", "projectedFighter",
|
||||||
|
"fittingMode")
|
||||||
|
|
||||||
def getText(self, itmContext, selection):
|
def getText(self, itmContext, selection):
|
||||||
return "{0} Stats".format(itmContext if itmContext is not None else "Item")
|
return "{0} Stats".format(itmContext if itmContext is not None else "Item")
|
||||||
@@ -29,6 +30,8 @@ class ItemStats(ContextMenu):
|
|||||||
fitID = self.mainFrame.getActiveFit()
|
fitID = self.mainFrame.getActiveFit()
|
||||||
sFit = service.Fit.getInstance()
|
sFit = service.Fit.getInstance()
|
||||||
stuff = sFit.getFit(fitID).ship
|
stuff = sFit.getFit(fitID).ship
|
||||||
|
elif srcContext == "fittingMode":
|
||||||
|
stuff = selection[0].item
|
||||||
else:
|
else:
|
||||||
stuff = selection[0]
|
stuff = selection[0]
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,12 @@ from gui.builtinViewColumns.state import State
|
|||||||
from gui.bitmapLoader import BitmapLoader
|
from gui.bitmapLoader import BitmapLoader
|
||||||
import gui.builtinViews.emptyView
|
import gui.builtinViews.emptyView
|
||||||
from gui.utils.exportHtml import exportHtml
|
from gui.utils.exportHtml import exportHtml
|
||||||
|
from logging import getLogger, Formatter
|
||||||
|
|
||||||
import gui.globalEvents as GE
|
import gui.globalEvents as GE
|
||||||
|
|
||||||
|
logger = getLogger(__name__)
|
||||||
|
|
||||||
#Tab spawning handler
|
#Tab spawning handler
|
||||||
class FitSpawner(gui.multiSwitch.TabSpawner):
|
class FitSpawner(gui.multiSwitch.TabSpawner):
|
||||||
def __init__(self, multiSwitch):
|
def __init__(self, multiSwitch):
|
||||||
@@ -339,7 +342,12 @@ 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)
|
||||||
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.
|
||||||
|
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()
|
||||||
@@ -441,12 +449,11 @@ class FittingView(d.Display):
|
|||||||
if fit.mode:
|
if fit.mode:
|
||||||
# Modes are special snowflakes and need a little manual loving
|
# Modes are special snowflakes and need a little manual loving
|
||||||
# We basically append the Mode rack and Mode to the modules
|
# 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"]:
|
if sFit.serviceFittingOptions["rackSlots"]:
|
||||||
self.blanks.append(len(self.mods))
|
self.blanks.append(len(self.mods))
|
||||||
self.mods.append(Rack.buildRack(Slot.MODE))
|
self.mods.append(Rack.buildRack(Slot.MODE))
|
||||||
|
|
||||||
self.blanks.append(len(self.mods))
|
|
||||||
self.mods.append(fit.mode)
|
self.mods.append(fit.mode)
|
||||||
else:
|
else:
|
||||||
self.mods = None
|
self.mods = None
|
||||||
@@ -488,12 +495,29 @@ class FittingView(d.Display):
|
|||||||
|
|
||||||
while sel != -1 and sel not in self.blanks:
|
while sel != -1 and sel not in self.blanks:
|
||||||
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
|
||||||
|
if hasattr(mod, "_Mode__item"):
|
||||||
|
srcContext = "fittingMode"
|
||||||
|
# Skip the normal processing
|
||||||
|
mod.isEmpty = True
|
||||||
|
|
||||||
|
itemContext = sMkt.getCategoryByItem(mod.item).name
|
||||||
|
fullContext = (srcContext, itemContext)
|
||||||
|
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts):
|
||||||
|
contexts.append(fullContext)
|
||||||
|
|
||||||
|
selection.append(mod)
|
||||||
|
|
||||||
|
|
||||||
if 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)
|
||||||
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)
|
||||||
|
|
||||||
|
|
||||||
if mod.charge is not None:
|
if mod.charge is not None:
|
||||||
srcContext = "fittingCharge"
|
srcContext = "fittingCharge"
|
||||||
itemContext = sMkt.getCategoryByItem(mod.charge).name
|
itemContext = sMkt.getCategoryByItem(mod.charge).name
|
||||||
|
|||||||
@@ -69,6 +69,12 @@ class ContextMenu(object):
|
|||||||
if m.display(srcContext, selection):
|
if m.display(srcContext, selection):
|
||||||
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