Add number of slots in the rack heading (#1535)
This commit is contained in:
@@ -144,10 +144,11 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
return empty
|
||||
|
||||
@classmethod
|
||||
def buildRack(cls, slot):
|
||||
def buildRack(cls, slot, num=None):
|
||||
empty = Rack(None)
|
||||
empty.__slot = slot
|
||||
empty.dummySlot = slot
|
||||
empty.num = num
|
||||
return empty
|
||||
|
||||
@property
|
||||
@@ -799,6 +800,7 @@ class Module(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
|
||||
class Rack(Module):
|
||||
"""
|
||||
This is simply the Module class named something else to differentiate
|
||||
it for app logic. This class does not do anything special
|
||||
it for app logic. The only thing interesting about it is the num property,
|
||||
which is the number of slots for this rack
|
||||
"""
|
||||
pass
|
||||
num = None
|
||||
|
||||
@@ -73,7 +73,7 @@ class BaseName(ViewColumn):
|
||||
if stuff.slot == Slot.MODE:
|
||||
return '─ Tactical Mode ─'
|
||||
else:
|
||||
return '─ {} Slots ─'.format(Slot.getName(stuff.slot).capitalize())
|
||||
return '─ {} Slots ({}) ─'.format(Slot.getName(stuff.slot).capitalize(), stuff.num)
|
||||
else:
|
||||
return ""
|
||||
elif isinstance(stuff, Module):
|
||||
|
||||
@@ -520,7 +520,7 @@ class FittingView(d.Display):
|
||||
# second loop modifies self.mods, rewrites self.blanks to represent actual index of blanks
|
||||
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))
|
||||
self.mods.insert(x + i, Rack.buildRack(slot, sum(m.slot == slot for m in self.mods)))
|
||||
|
||||
if fit.mode:
|
||||
# Modes are special snowflakes and need a little manual loving
|
||||
@@ -528,7 +528,7 @@ class FittingView(d.Display):
|
||||
# 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.mods.append(Rack.buildRack(Slot.MODE, None))
|
||||
|
||||
self.mods.append(fit.mode)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user