Merge branch 'master' of https://github.com/pyfa-org/Pyfa into origin_master

This commit is contained in:
Ryan Holmes
2019-03-21 19:48:10 -04:00
4 changed files with 25 additions and 19 deletions

View File

@@ -110,6 +110,9 @@ class BoosterView(d.Display):
self.origional = fit.boosters if fit is not None else None
self.boosters = stuff = fit.boosters[:] if fit is not None else None
if stuff is not None:
stuff.sort(key=lambda booster: booster.slot or 0)
if event.fitID != self.lastFitId:
self.lastFitId = event.fitID

View File

@@ -2,6 +2,7 @@ import threading
import time
# noinspection PyPackageRequirements
import wx
from service.const import PortEftOptions
from service.settings import HTMLExportSettings
from service.fit import Fit
from service.port import Port
@@ -208,8 +209,10 @@ class exportHtmlThread(threading.Thread):
if self.stopRunning:
return
try:
eftFit = Port.exportEft(getFit(fit[0]))
print(eftFit)
eftFit = Port.exportEft(getFit(fit[0]), options={
PortEftOptions.IMPLANTS: True,
PortEftOptions.MUTATIONS: True,
PortEftOptions.LOADED_CHARGES: True})
HTMLfit = (
' <li data-role="collapsible" data-iconpos="right" data-shadow="false" '

View File

@@ -43,9 +43,9 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
pyfalog = Logger(__name__)
EFT_OPTIONS = (
(PortEftOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortEftOptions.MUTATIONS.value, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(PortEftOptions.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', True),
(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),
)
@@ -80,14 +80,14 @@ def exportEft(fit, options, callback):
modName = module.baseItem.name
else:
modName = module.item.name
if module.isMutated and options[PortEftOptions.MUTATIONS.value]:
if module.isMutated and options[PortEftOptions.MUTATIONS]:
mutants[mutantReference] = module
mutationSuffix = ' [{}]'.format(mutantReference)
mutantReference += 1
else:
mutationSuffix = ''
modOfflineSuffix = ' {}'.format(OFFLINE_SUFFIX) if module.state == FittingModuleState.OFFLINE else ''
if module.charge and options[PortEftOptions.LOADED_CHARGES.value]:
if module.charge and options[PortEftOptions.LOADED_CHARGES]:
rackLines.append('{}, {}{}{}'.format(
modName, module.charge.name, modOfflineSuffix, mutationSuffix))
else:
@@ -116,15 +116,15 @@ def exportEft(fit, options, callback):
sections.append('\n\n'.join(minionSection))
# Section 3: implants, boosters
if options[PortEftOptions.IMPLANTS.value]:
if options[PortEftOptions.IMPLANTS]:
charSection = []
implantLines = []
for implant in fit.implants:
for implant in sorted(fit.implants, key=lambda i: i.slot or 0):
implantLines.append(implant.item.name)
if implantLines:
charSection.append('\n'.join(implantLines))
boosterLines = []
for booster in fit.boosters:
for booster in sorted(fit.boosters, key=lambda b: b.slot or 0):
boosterLines.append(booster.item.name)
if boosterLines:
charSection.append('\n'.join(boosterLines))
@@ -143,7 +143,7 @@ def exportEft(fit, options, callback):
# Section 5: mutated modules' details
mutationLines = []
if mutants and options[PortEftOptions.MUTATIONS.value]:
if mutants and options[PortEftOptions.MUTATIONS]:
for mutantReference in sorted(mutants):
mutant = mutants[mutantReference]
mutationLines.append(renderMutant(mutant, firstPrefix='[{}] '.format(mutantReference), prefix=' '))

View File

@@ -23,10 +23,10 @@ from service.price import Price as sPrc
MULTIBUY_OPTIONS = (
(PortMultiBuyOptions.LOADED_CHARGES.value, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortMultiBuyOptions.IMPLANTS.value, 'Implants && Boosters', 'Export implants and boosters', False),
(PortMultiBuyOptions.CARGO.value, 'Cargo', 'Export cargo contents', True),
(PortMultiBuyOptions.OPTIMIZE_PRICES.value, 'Optimize Prices', 'Replace items by cheaper alternatives', False),
(PortMultiBuyOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortMultiBuyOptions.IMPLANTS, 'Implants && Boosters', 'Export implants and boosters', False),
(PortMultiBuyOptions.CARGO, 'Cargo', 'Export cargo contents', True),
(PortMultiBuyOptions.OPTIMIZE_PRICES, 'Optimize Prices', 'Replace items by cheaper alternatives', False),
)
@@ -39,7 +39,7 @@ def exportMultiBuy(fit, options, callback):
if module.isMutated:
continue
_addItem(itemAmounts, module.item)
if module.charge and options[PortMultiBuyOptions.LOADED_CHARGES.value]:
if module.charge and options[PortMultiBuyOptions.LOADED_CHARGES]:
_addItem(itemAmounts, module.charge, module.numCharges)
for drone in fit.drones:
@@ -48,18 +48,18 @@ def exportMultiBuy(fit, options, callback):
for fighter in fit.fighters:
_addItem(itemAmounts, fighter.item, fighter.amountActive)
if options[PortMultiBuyOptions.CARGO.value]:
if options[PortMultiBuyOptions.CARGO]:
for cargo in fit.cargo:
_addItem(itemAmounts, cargo.item, cargo.amount)
if options[PortMultiBuyOptions.IMPLANTS.value]:
if options[PortMultiBuyOptions.IMPLANTS]:
for implant in fit.implants:
_addItem(itemAmounts, implant.item)
for booster in fit.boosters:
_addItem(itemAmounts, booster.item)
if options[PortMultiBuyOptions.OPTIMIZE_PRICES.value]:
if options[PortMultiBuyOptions.OPTIMIZE_PRICES]:
def formatCheaperExportCb(replacementsCheaper):
updatedAmounts = {}