Add implants & boosters option to multibuy export
This commit is contained in:
@@ -24,6 +24,7 @@ from collections import OrderedDict
|
||||
import wx
|
||||
|
||||
from service.port.eft import EFT_OPTIONS
|
||||
from service.port.multibuy import MULTIBUY_OPTIONS
|
||||
from service.settings import SettingsProvider
|
||||
|
||||
|
||||
@@ -50,7 +51,7 @@ class CopySelectDialog(wx.Dialog):
|
||||
("XML", (CopySelectDialog.copyFormatXml, None)),
|
||||
("DNA", (CopySelectDialog.copyFormatDna, None)),
|
||||
("ESI", (CopySelectDialog.copyFormatEsi, None)),
|
||||
("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, None)),
|
||||
("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, MULTIBUY_OPTIONS)),
|
||||
("EFS", (CopySelectDialog.copyFormatEfs, None)),
|
||||
))
|
||||
|
||||
|
||||
@@ -717,7 +717,7 @@ class MainFrame(wx.Frame):
|
||||
|
||||
def clipboardMultiBuy(self, options):
|
||||
fit = db_getFit(self.getActiveFit())
|
||||
toClipboard(Port.exportMultiBuy(fit))
|
||||
toClipboard(Port.exportMultiBuy(fit, options))
|
||||
|
||||
def clipboardEfs(self, options):
|
||||
fit = db_getFit(self.getActiveFit())
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
|
||||
import re
|
||||
from enum import Enum
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
@@ -36,7 +37,6 @@ from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
from service.port.muta import parseMutant, renderMutant
|
||||
from service.port.shared import IPortUser, fetchItem, processing_notify
|
||||
from enum import Enum
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -47,16 +47,17 @@ class Options(Enum):
|
||||
MUTATIONS = 2
|
||||
|
||||
|
||||
MODULE_CATS = ('Module', 'Subsystem', 'Structure Module')
|
||||
SLOT_ORDER = (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE)
|
||||
OFFLINE_SUFFIX = '/OFFLINE'
|
||||
|
||||
EFT_OPTIONS = (
|
||||
(Options.IMPLANTS.value, 'Implants && Boosters', 'Exports implants and boosters'),
|
||||
(Options.MUTATIONS.value, 'Mutated Attributes', 'Exports mutated modules\' stats'),
|
||||
)
|
||||
|
||||
|
||||
MODULE_CATS = ('Module', 'Subsystem', 'Structure Module')
|
||||
SLOT_ORDER = (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM, Slot.SERVICE)
|
||||
OFFLINE_SUFFIX = '/OFFLINE'
|
||||
|
||||
|
||||
def exportEft(fit, options):
|
||||
# EFT formatted export is split in several sections, each section is
|
||||
# separated from another using 2 blank lines. Sections might have several
|
||||
|
||||
@@ -18,10 +18,21 @@
|
||||
# =============================================================================
|
||||
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from service.fit import Fit as svcFit
|
||||
|
||||
|
||||
def exportMultiBuy(fit):
|
||||
class Options(Enum):
|
||||
IMPLANTS = 1
|
||||
|
||||
|
||||
MULTIBUY_OPTIONS = (
|
||||
(Options.IMPLANTS.value, 'Implants && Boosters', 'Exports implants and boosters'),
|
||||
)
|
||||
|
||||
|
||||
def exportMultiBuy(fit, options):
|
||||
itemCounts = {}
|
||||
|
||||
def addItem(item, quantity=1):
|
||||
@@ -45,11 +56,12 @@ def exportMultiBuy(fit):
|
||||
for cargo in fit.cargo:
|
||||
addItem(cargo.item, cargo.amount)
|
||||
|
||||
for implant in fit.implants:
|
||||
addItem(implant.item)
|
||||
if options & Options.IMPLANTS.value:
|
||||
for implant in fit.implants:
|
||||
addItem(implant.item)
|
||||
|
||||
for booster in fit.boosters:
|
||||
addItem(booster.item)
|
||||
for booster in fit.boosters:
|
||||
addItem(booster.item)
|
||||
|
||||
exportLines = []
|
||||
exportLines.append(fit.ship.item.name)
|
||||
|
||||
@@ -284,5 +284,5 @@ class Port(object):
|
||||
|
||||
# Multibuy-related methods
|
||||
@staticmethod
|
||||
def exportMultiBuy(fit):
|
||||
return exportMultiBuy(fit)
|
||||
def exportMultiBuy(fit, options):
|
||||
return exportMultiBuy(fit, options)
|
||||
|
||||
Reference in New Issue
Block a user