Add possibility to export formatted DNA
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,7 +135,7 @@ 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()
|
||||
@@ -178,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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user