From eeef2104c24c0fedb39d50c1c0034b959d3ddb2e Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 12 Feb 2019 13:03:15 +0300 Subject: [PATCH] Move option of exporting charges from general preferences to EFT and multibuy exports --- gui/builtinPreferenceViews/pyfaGeneralPreferences.py | 9 --------- service/fit.py | 1 - service/port/dna.py | 2 +- service/port/eft.py | 7 ++++--- service/port/esi.py | 2 +- service/port/multibuy.py | 7 +++---- service/port/xml.py | 2 +- 7 files changed, 10 insertions(+), 20 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index a31e56f8a..51d32ab5d 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -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() diff --git a/service/fit.py b/service/fit.py index ad1e5c4dd..035bb50ee 100644 --- a/service/fit.py +++ b/service/fit.py @@ -89,7 +89,6 @@ class Fit(FitDeprecated): "showTooltip": True, "showMarketShortcuts": False, "enableGaugeAnimation": True, - "exportCharges": True, "openFitInNew": False, "priceSystem": "Jita", "priceSource": "eve-marketdata.com", diff --git a/service/port/dna.py b/service/port/dna.py index bd2645ef8..bc64e9e99 100644 --- a/service/port/dna.py +++ b/service/port/dna.py @@ -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 diff --git a/service/port/eft.py b/service/port/eft.py index 48b0e5350..9c48dd1d0 100644 --- a/service/port/eft.py +++ b/service/port/eft.py @@ -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: diff --git a/service/port/esi.py b/service/port/esi.py index f1e02d13a..8268f23fa 100644 --- a/service/port/esi.py +++ b/service/port/esi.py @@ -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 diff --git a/service/port/multibuy.py b/service/port/multibuy.py index 644836693..d31b9f33a 100644 --- a/service/port/multibuy.py +++ b/service/port/multibuy.py @@ -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: diff --git a/service/port/xml.py b/service/port/xml.py index 54d5a98eb..432bbcdd8 100644 --- a/service/port/xml.py +++ b/service/port/xml.py @@ -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