Add Mode and separation to fitting list.
Todo: A few exceptions are thrown when trying to remove mode via double click, spawn context menu, move to a different position, etc. All simply because Mode is not a Module. Will need to add try-except blocks to cover these instances
This commit is contained in:
@@ -495,6 +495,10 @@ class Fit(object):
|
||||
Slot.RIG: "rigSlots",
|
||||
Slot.SUBSYSTEM: "maxSubSystems"}
|
||||
|
||||
if type == Slot.MODE:
|
||||
# Mode slot doesn't really exist, return default 0
|
||||
return 0
|
||||
|
||||
slotsUsed = self.getSlotsUsed(type, countDummies)
|
||||
totalSlots = self.ship.getModifiedItemAttr(slots[type]) or 0
|
||||
return int(totalSlots - slotsUsed)
|
||||
|
||||
@@ -36,6 +36,7 @@ class Slot(Enum):
|
||||
HIGH = 3
|
||||
RIG = 4
|
||||
SUBSYSTEM = 5
|
||||
MODE = 6 # not a real slot, need for pyfa display rack separation
|
||||
|
||||
class Hardpoint(Enum):
|
||||
NONE = 0
|
||||
|
||||
@@ -42,7 +42,10 @@ class BaseName(ViewColumn):
|
||||
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
|
||||
elif isinstance(stuff, Rack):
|
||||
if service.Fit.getInstance().serviceFittingOptions["rackLabels"]:
|
||||
return u'─ {} Slots ─'.format(Slot.getName(stuff.slot).capitalize())
|
||||
if stuff.slot == Slot.MODE:
|
||||
return u'─ Tactical Mode ─'
|
||||
else:
|
||||
return u'─ {} Slots ─'.format(Slot.getName(stuff.slot).capitalize())
|
||||
else:
|
||||
return ""
|
||||
elif isinstance(stuff, Module):
|
||||
|
||||
@@ -23,6 +23,7 @@ import service
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui import bitmapLoader
|
||||
from eos.types import Mode
|
||||
|
||||
class CapacitorUse(ViewColumn):
|
||||
name = "Capacitor Usage"
|
||||
@@ -38,6 +39,9 @@ class CapacitorUse(ViewColumn):
|
||||
|
||||
|
||||
def getText(self, mod):
|
||||
if isinstance(mod, Mode):
|
||||
return ""
|
||||
|
||||
capUse = mod.capUse
|
||||
if capUse:
|
||||
return "%s%s" % ("+" if capUse < 0 else "", (formatAmount(-capUse, 3, 0, 3)))
|
||||
|
||||
@@ -23,6 +23,7 @@ from gui import bitmapLoader
|
||||
import service
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
import wx
|
||||
from eos.types import Mode
|
||||
|
||||
class MaxRange(ViewColumn):
|
||||
name = "Max Range"
|
||||
@@ -51,6 +52,9 @@ class MaxRange(ViewColumn):
|
||||
self.mask |= wx.LIST_MASK_TEXT
|
||||
|
||||
def getText(self, stuff):
|
||||
if isinstance(stuff, Mode):
|
||||
return ""
|
||||
|
||||
maxRange = stuff.maxRange if hasattr(stuff, "maxRange") else stuff.getModifiedItemAttr("maxRange")
|
||||
falloff = stuff.falloff
|
||||
if falloff:
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import builtinViewColumns
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui import bitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
@@ -69,7 +68,9 @@ class Miscellanea(ViewColumn):
|
||||
itemGroup = item.group.name
|
||||
itemCategory = item.category.name
|
||||
|
||||
if itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Combat Drone", "Fighter Drone"):
|
||||
if itemGroup == "Ship Modifiers":
|
||||
return "", None
|
||||
elif itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Combat Drone", "Fighter Drone"):
|
||||
trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed")
|
||||
if not trackingSpeed:
|
||||
return "", None
|
||||
|
||||
@@ -419,6 +419,13 @@ class FittingView(d.Display):
|
||||
for i, (x, slot) in enumerate(self.blanks):
|
||||
self.blanks[i] = x+i # modify blanks with actual index
|
||||
self.mods.insert(x+i, Rack.buildRack(slot))
|
||||
|
||||
if fit.mode:
|
||||
# Modes are special snowflakes and need a little more love
|
||||
# Manually add mode separator and modes at the end of the modules
|
||||
self.blanks.append(len(self.mods))
|
||||
self.mods.insert(len(self.mods), Rack.buildRack(Slot.MODE))
|
||||
self.mods.insert(len(self.mods), fit.mode)
|
||||
else:
|
||||
self.mods = None
|
||||
|
||||
@@ -544,7 +551,7 @@ class FittingView(d.Display):
|
||||
|
||||
font = (self.GetClassDefaultAttributes()).font
|
||||
for i, mod in enumerate(self.mods):
|
||||
if slotMap[mod.slot]:
|
||||
if hasattr(mod,"slot") and slotMap[mod.slot]:
|
||||
self.SetItemBackgroundColour(i, wx.Colour(204, 51, 51))
|
||||
elif sFit.serviceFittingOptions["colorFitBySlot"] and not isinstance(mod, Rack):
|
||||
self.SetItemBackgroundColour(i, self.slotColour(mod.slot))
|
||||
|
||||
Reference in New Issue
Block a user