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

@@ -76,10 +76,6 @@ class PFGeneralPref(PreferenceView):
self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, "Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbGaugeAnimation, 0, wx.ALL | wx.EXPAND, 5)
self.cbExportCharges = wx.CheckBox(panel, wx.ID_ANY, "Export loaded charges", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbExportCharges, 0, wx.ALL | wx.EXPAND, 5)
self.cbOpenFitInNew = wx.CheckBox(panel, wx.ID_ANY, "Open fittings in a new page by default",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbOpenFitInNew, 0, wx.ALL | wx.EXPAND, 5)
@@ -133,7 +129,6 @@ class PFGeneralPref(PreferenceView):
self.cbShowTooltip.SetValue(self.sFit.serviceFittingOptions["showTooltip"] or False)
self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False)
self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"])
self.cbExportCharges.SetValue(self.sFit.serviceFittingOptions["exportCharges"])
self.cbOpenFitInNew.SetValue(self.sFit.serviceFittingOptions["openFitInNew"])
self.chPriceSource.SetStringSelection(self.sFit.serviceFittingOptions["priceSource"])
self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"])
@@ -151,7 +146,6 @@ class PFGeneralPref(PreferenceView):
self.cbShowTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowTooltip)
self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts)
self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation)
self.cbExportCharges.Bind(wx.EVT_CHECKBOX, self.onCBExportCharges)
self.cbOpenFitInNew.Bind(wx.EVT_CHECKBOX, self.onCBOpenFitInNew)
self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection)
self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection)
@@ -220,9 +214,6 @@ class PFGeneralPref(PreferenceView):
def onCBGaugeAnimation(self, event):
self.sFit.serviceFittingOptions["enableGaugeAnimation"] = self.cbGaugeAnimation.GetValue()
def onCBExportCharges(self, event):
self.sFit.serviceFittingOptions["exportCharges"] = self.cbExportCharges.GetValue()
def onCBOpenFitInNew(self, event):
self.sFit.serviceFittingOptions["openFitInNew"] = self.cbOpenFitInNew.GetValue()

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