Move option of exporting charges from general preferences to EFT and multibuy exports

This commit is contained in:
DarkPhoenix
2019-02-12 13:03:15 +03:00
parent 2098ff6da1
commit eeef2104c2
7 changed files with 10 additions and 20 deletions

View File

@@ -89,7 +89,6 @@ class Fit(FitDeprecated):
"showTooltip": True,
"showMarketShortcuts": False,
"enableGaugeAnimation": True,
"exportCharges": True,
"openFitInNew": False,
"priceSystem": "Jita",
"priceSource": "eve-marketdata.com",

View File

@@ -138,7 +138,7 @@ def exportDna(fit):
mods[mod.itemID] = 0
mods[mod.itemID] += 1
if mod.charge and sFit.serviceFittingOptions["exportCharges"]:
if mod.charge:
if mod.chargeID not in charges:
charges[mod.chargeID] = 0
# `or 1` because some charges (ie scripts) are without qty

View File

@@ -45,11 +45,13 @@ pyfalog = Logger(__name__)
class Options(Enum):
IMPLANTS = 1
MUTATIONS = 2
LOADED_CHARGES = 3
EFT_OPTIONS = (
(Options.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
(Options.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(Options.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(Options.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
)
@@ -68,7 +70,6 @@ def exportEft(fit, options):
# Section 1: modules, rigs, subsystems, services
modsBySlotType = {}
sFit = svcFit.getInstance()
for module in fit.modules:
modsBySlotType.setdefault(module.slot, []).append(module)
modSection = []
@@ -92,7 +93,7 @@ def exportEft(fit, options):
else:
mutationSuffix = ''
modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == State.OFFLINE else ''
if module.charge and sFit.serviceFittingOptions['exportCharges']:
if module.charge and options & Options.LOADED_CHARGES.value:
rackLines.append('{}, {}{}{}'.format(
modName, module.charge.name, modOfflineSuffix, mutationSuffix))
else:

View File

@@ -97,7 +97,7 @@ def exportESI(ofit):
item['type_id'] = module.item.ID
fit['items'].append(item)
if module.charge and sFit.serviceFittingOptions["exportCharges"]:
if module.charge:
if module.chargeID not in charges:
charges[module.chargeID] = 0
# `or 1` because some charges (ie scripts) are without qty

View File

@@ -20,15 +20,15 @@
from enum import Enum
from service.fit import Fit as svcFit
class Options(Enum):
IMPLANTS = 1
CARGO = 2
LOADED_CHARGES = 3
MULTIBUY_OPTIONS = (
(Options.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(Options.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
(Options.CARGO.value, 'Cargo', 'Export cargo contents', True),
)
@@ -42,14 +42,13 @@ def exportMultiBuy(fit, options):
itemCounts[item] = 0
itemCounts[item] += quantity
exportCharges = svcFit.getInstance().serviceFittingOptions["exportCharges"]
for module in fit.modules:
if module.item:
# Mutated items are of no use for multibuy
if module.isMutated:
continue
addItem(module.item)
if exportCharges and module.charge:
if module.charge and options & Options.LOADED_CHARGES.value:
addItem(module.charge, module.numCharges)
for drone in fit.drones:

View File

@@ -283,7 +283,7 @@ def exportXml(iportuser, *fits):
hardware.setAttribute("slot", "%s slot %d" % (slotName, slotId))
fitting.appendChild(hardware)
if module.charge and sFit.serviceFittingOptions["exportCharges"]:
if module.charge:
if module.charge.name not in charges:
charges[module.charge.name] = 0
# `or 1` because some charges (ie scripts) are without qty