Add option to disable cargo export in EFT format

This commit is contained in:
DarkPhoenix
2019-08-07 12:57:20 +03:00
parent 647bdb78df
commit 04178ca824
2 changed files with 12 additions and 9 deletions

View File

@@ -67,6 +67,7 @@ class PortEftOptions(IntEnum):
IMPLANTS = 1
MUTATIONS = 2
LOADED_CHARGES = 3
CARGO = 4
@unique

View File

@@ -43,11 +43,12 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
pyfalog = Logger(__name__)
EFT_OPTIONS = (
(PortEftOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortEftOptions.MUTATIONS, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(PortEftOptions.IMPLANTS, 'Implants && Boosters', 'Export implants and boosters', True),
)
(PortEftOptions.CARGO, 'Cargo', 'Export cargo hold contents', True))
MODULE_CATS = ('Module', 'Subsystem', 'Structure Module')
@@ -133,14 +134,15 @@ def exportEft(fit, options, callback):
sections.append('\n\n'.join(charSection))
# Section 4: cargo
cargoLines = []
for cargo in sorted(
fit.cargo,
key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name)
):
cargoLines.append('{} x{}'.format(cargo.item.name, cargo.amount))
if cargoLines:
sections.append('\n'.join(cargoLines))
if options[PortEftOptions.CARGO]:
cargoLines = []
for cargo in sorted(
fit.cargo,
key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name)
):
cargoLines.append('{} x{}'.format(cargo.item.name, cargo.amount))
if cargoLines:
sections.append('\n'.join(cargoLines))
# Section 5: mutated modules' details
mutationLines = []