Use short ship names along with fit names

This commit is contained in:
DarkPhoenix
2019-08-01 11:12:26 +03:00
parent 0114417018
commit 154122388e
3 changed files with 7 additions and 6 deletions

View File

@@ -44,11 +44,12 @@ pyfalog = Logger(__name__)
class FitLite:
def __init__(self, id=None, name=None, shipID=None, shipName=None):
def __init__(self, id=None, name=None, shipID=None, shipName=None, shipNameShort=None):
self.ID = id
self.name = name
self.shipID = shipID
self.shipName = shipName
self.shipNameShort = shipNameShort
def __repr__(self):
return 'FitLite(ID={})'.format(self.ID)

View File

@@ -64,15 +64,15 @@ class BaseName(ViewColumn):
info = stuff.getProjectionInfo(fitID)
if info:
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.getShortName())
pyfalog.warning("Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff),
info)
return "<unknown>"
else:
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
return "%s (%s)" % (stuff.name, stuff.ship.item.getShortName())
elif isinstance(stuff, FitLite):
return "{} ({})".format(stuff.name, stuff.shipName)
return "{} ({})".format(stuff.name, stuff.shipNameShort)
elif isinstance(stuff, Rack):
if FitSvc.getInstance().serviceFittingOptions["rackLabels"]:
if stuff.slot == FittingSlot.MODE:

View File

@@ -110,10 +110,10 @@ class Fit:
for shipID in shipMap:
ship = eos.db.getItem(shipID)
if ship is not None:
shipMap[shipID] = ship.name
shipMap[shipID] = (ship.name, ship.getShortName())
for fit in fits:
try:
fit.shipName = shipMap[fit.shipID]
fit.shipName, fit.shipNameShort = shipMap[fit.shipID]
except KeyError:
pass
return fits