Merge branch 'master' into singularity

This commit is contained in:
DarkPhoenix
2019-05-04 02:44:12 +03:00
5 changed files with 30 additions and 15 deletions

View File

@@ -23,13 +23,14 @@ from collections import OrderedDict
# noinspection PyPackageRequirements
import wx
from eos.db import getFit
from gui.utils.clipboard import toClipboard
from service.const import PortMultiBuyOptions
from service.port import EfsPort, Port
from service.port.dna import DNA_OPTIONS
from service.port.eft import EFT_OPTIONS
from service.port.multibuy import MULTIBUY_OPTIONS
from service.settings import SettingsProvider
from service.port import EfsPort, Port
from service.const import PortMultiBuyOptions
from eos.db import getFit
from gui.utils.clipboard import toClipboard
class CopySelectDialog(wx.Dialog):
@@ -60,9 +61,9 @@ class CopySelectDialog(wx.Dialog):
("EFT", (CopySelectDialog.copyFormatEft, EFT_OPTIONS)),
("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, MULTIBUY_OPTIONS)),
("ESI", (CopySelectDialog.copyFormatEsi, None)),
("DNA", (CopySelectDialog.copyFormatDna, DNA_OPTIONS)),
("EFS", (CopySelectDialog.copyFormatEfs, None)),
# ("XML", (CopySelectDialog.copyFormatXml, None)),
# ("DNA", (CopySelectDialog.copyFormatDna, None)),
))
defaultFormatOptions = {}
@@ -99,6 +100,8 @@ class CopySelectDialog(wx.Dialog):
for optId, optName, optDesc, _ in formatOptions:
checkbox = wx.CheckBox(self, -1, optName)
if optDesc:
checkbox.SetToolTip(wx.ToolTip(optDesc))
self.options[formatId][optId] = checkbox
if self.settings['options'].get(formatId, {}).get(optId, defaultFormatOptions.get(formatId, {}).get(optId)):
checkbox.SetValue(True)
@@ -166,7 +169,7 @@ class CopySelectDialog(wx.Dialog):
def exportDna(self, options, callback):
fit = getFit(self.mainFrame.getActiveFit())
Port.exportDna(fit, callback)
Port.exportDna(fit, options, callback)
def exportEsi(self, options, callback):
fit = getFit(self.mainFrame.getActiveFit())

View File

@@ -81,6 +81,14 @@ class PortEftRigSize(IntEnum):
CAPITAL = 4
@unique
class PortDnaOptions(IntEnum):
"""
Contains different types of items for DNA export
"""
FORMATTING = 1
@unique
class GuiAttrGroup(IntEnum):
"""
@@ -101,4 +109,4 @@ class GuiAttrGroup(IntEnum):
JUMP_SYSTEMS = auto()
PROPULSIONS = auto()
FIGHTERS = auto()
SHIP_GROUP = auto()
SHIP_GROUP = auto()

View File

@@ -32,12 +32,17 @@ from eos.saveddata.fit import Fit
from eos.saveddata.module import Module
from eos.saveddata.ship import Ship
from gui.fitCommands.helpers import activeStateLimit
from service.const import PortDnaOptions
from service.fit import Fit as svcFit
from service.market import Market
pyfalog = Logger(__name__)
DNA_OPTIONS = (
(PortDnaOptions.FORMATTING, 'Formatting Tags', 'Include formatting tags to paste fit directly into corp bulletins, MOTD, etc.', True),
)
def importDna(string, fitName=None):
sMkt = Market.getInstance()
@@ -130,12 +135,11 @@ def importDna(string, fitName=None):
return f
def exportDna(fit, callback):
def exportDna(fit, options, callback):
dna = str(fit.shipID)
subsystems = [] # EVE cares which order you put these in
mods = OrderedDict()
charges = OrderedDict()
sFit = svcFit.getInstance()
for mod in fit.modules:
if not mod.isEmpty:
if mod.slot == FittingSlot.SUBSYSTEM:
@@ -163,9 +167,6 @@ def exportDna(fit, callback):
for fighter in fit.fighters:
dna += ":{0};{1}".format(fighter.itemID, fighter.amountActive)
for fighter in fit.fighters:
dna += ":{0};{1}".format(fighter.itemID, fighter.amountActive)
for cargo in fit.cargo:
# DNA format is a simple/dumb format. As CCP uses the slot information of the item itself
# without designating slots in the DNA standard, we need to make sure we only include
@@ -182,6 +183,9 @@ def exportDna(fit, callback):
text = dna + "::"
if options[PortDnaOptions.FORMATTING]:
text = '<url=fitting:{}>{}</url>'.format(text, fit.name)
if callback:
callback(text)
else:

View File

@@ -272,8 +272,8 @@ class Port(object):
return importDna(string, fitName=fitName)
@staticmethod
def exportDna(fit, callback=None):
return exportDna(fit, callback=callback)
def exportDna(fit, options, callback=None):
return exportDna(fit, options, callback=callback)
# ESI-related methods
@staticmethod

View File

@@ -1 +1 @@
version: v2.9.3dev1
version: v2.9.3