From 5f9bf4a861ec80e6c5f2419285035453c09c4fb5 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 3 May 2019 22:41:10 +0300 Subject: [PATCH 1/5] Bump version --- version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.yml b/version.yml index 91b9f5274..a97dd1036 100644 --- a/version.yml +++ b/version.yml @@ -1 +1 @@ -version: v2.9.2 +version: v2.9.3 From 4b6c881dcaa9b5af6604623e7b357903be0d818c Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 4 May 2019 02:26:09 +0300 Subject: [PATCH 2/5] Re-enable DNA export --- gui/copySelectDialog.py | 2 +- service/port/dna.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index 55b02e535..924822e55 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -60,9 +60,9 @@ class CopySelectDialog(wx.Dialog): ("EFT", (CopySelectDialog.copyFormatEft, EFT_OPTIONS)), ("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, MULTIBUY_OPTIONS)), ("ESI", (CopySelectDialog.copyFormatEsi, None)), + ("DNA", (CopySelectDialog.copyFormatDna, None)), ("EFS", (CopySelectDialog.copyFormatEfs, None)), # ("XML", (CopySelectDialog.copyFormatXml, None)), - # ("DNA", (CopySelectDialog.copyFormatDna, None)), )) defaultFormatOptions = {} diff --git a/service/port/dna.py b/service/port/dna.py index e0409be8b..102ec5a23 100644 --- a/service/port/dna.py +++ b/service/port/dna.py @@ -135,7 +135,6 @@ def exportDna(fit, callback): 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 +162,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 From 7f2121e98d5839dff23331098f54a0523cb1d2dc Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 4 May 2019 02:38:19 +0300 Subject: [PATCH 3/5] Add possibility to export formatted DNA --- gui/copySelectDialog.py | 13 +++++++------ service/const.py | 10 +++++++++- service/port/dna.py | 10 +++++++++- service/port/port.py | 4 ++-- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index 924822e55..d5c4a70d8 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -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,7 +61,7 @@ class CopySelectDialog(wx.Dialog): ("EFT", (CopySelectDialog.copyFormatEft, EFT_OPTIONS)), ("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, MULTIBUY_OPTIONS)), ("ESI", (CopySelectDialog.copyFormatEsi, None)), - ("DNA", (CopySelectDialog.copyFormatDna, None)), + ("DNA", (CopySelectDialog.copyFormatDna, DNA_OPTIONS)), ("EFS", (CopySelectDialog.copyFormatEfs, None)), # ("XML", (CopySelectDialog.copyFormatXml, None)), )) @@ -166,7 +167,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()) diff --git a/service/const.py b/service/const.py index d09d809f6..5fa2b671f 100644 --- a/service/const.py +++ b/service/const.py @@ -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() \ No newline at end of file + SHIP_GROUP = auto() diff --git a/service/port/dna.py b/service/port/dna.py index 102ec5a23..c67394210 100644 --- a/service/port/dna.py +++ b/service/port/dna.py @@ -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 = '{}'.format(text, fit.name) + if callback: callback(text) else: diff --git a/service/port/port.py b/service/port/port.py index fc75227e0..60ab29663 100644 --- a/service/port/port.py +++ b/service/port/port.py @@ -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 From 8222686dda7da12d04acd118f7efadfcbac80b6e Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 4 May 2019 02:43:02 +0300 Subject: [PATCH 4/5] Enable tooltips for export options --- gui/copySelectDialog.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index d5c4a70d8..cf70adae5 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -100,6 +100,7 @@ class CopySelectDialog(wx.Dialog): for optId, optName, optDesc, _ in formatOptions: checkbox = wx.CheckBox(self, -1, optName) + 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) From 013a2264c0d25a7ca671c82b86201a07d36407f0 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 4 May 2019 02:43:33 +0300 Subject: [PATCH 5/5] Show tooltip only if there's something to show --- gui/copySelectDialog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gui/copySelectDialog.py b/gui/copySelectDialog.py index cf70adae5..82b57059b 100644 --- a/gui/copySelectDialog.py +++ b/gui/copySelectDialog.py @@ -100,7 +100,8 @@ class CopySelectDialog(wx.Dialog): for optId, optName, optDesc, _ in formatOptions: checkbox = wx.CheckBox(self, -1, optName) - checkbox.SetToolTip(wx.ToolTip(optDesc)) + 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)