Have CTRL-C copy in EFT format and move the dialogue to CTRL-SHIFT-C
This commit is contained in:
@@ -565,7 +565,8 @@ class MainFrame(wx.Frame):
|
||||
self.Bind(wx.EVT_MENU, self.toggleOverrides, id=menuBar.toggleOverridesId)
|
||||
|
||||
# Clipboard exports
|
||||
self.Bind(wx.EVT_MENU, self.exportToClipboard, id=wx.ID_COPY)
|
||||
self.Bind(wx.EVT_MENU, self.exportToClipboardDirectEft, id=menuBar.copyDirectEftId)
|
||||
self.Bind(wx.EVT_MENU, self.exportToClipboard, id=menuBar.copyWithDialogId)
|
||||
|
||||
# Fitting Restrictions
|
||||
self.Bind(wx.EVT_MENU, self.toggleIgnoreRestriction, id=menuBar.toggleIgnoreRestrictionID)
|
||||
@@ -623,7 +624,16 @@ class MainFrame(wx.Frame):
|
||||
(wx.ACCEL_CMD, wx.WXK_PAGEUP, ctabprev),
|
||||
|
||||
(wx.ACCEL_CMD | wx.ACCEL_SHIFT, ord("Z"), wx.ID_REDO),
|
||||
|
||||
|
||||
# Ctrl+Shift+C for copy with dialog (must come before Ctrl+C)
|
||||
# Note: use lowercase 'c' because SHIFT is already in flags
|
||||
(wx.ACCEL_CTRL | wx.ACCEL_SHIFT, ord('c'), menuBar.copyWithDialogId),
|
||||
(wx.ACCEL_CMD | wx.ACCEL_SHIFT, ord('c'), menuBar.copyWithDialogId),
|
||||
|
||||
# Ctrl+C for direct EFT copy
|
||||
(wx.ACCEL_CTRL, ord('c'), menuBar.copyDirectEftId),
|
||||
(wx.ACCEL_CMD, ord('c'), menuBar.copyDirectEftId),
|
||||
|
||||
# Shift+Tab for previous character
|
||||
(wx.ACCEL_SHIFT, wx.WXK_TAB, charPrevId)
|
||||
]
|
||||
@@ -813,6 +823,32 @@ class MainFrame(wx.Frame):
|
||||
else:
|
||||
self._openAfterImport(importData)
|
||||
|
||||
def exportToClipboardDirectEft(self, event):
|
||||
""" Copy fit to clipboard in EFT format without showing dialog """
|
||||
from eos.db import getFit
|
||||
from service.const import PortEftOptions
|
||||
from service.settings import SettingsProvider
|
||||
|
||||
fit = getFit(self.getActiveFit())
|
||||
if fit is None:
|
||||
return
|
||||
|
||||
# Get the default EFT export options from settings
|
||||
defaultOptions = {
|
||||
PortEftOptions.LOADED_CHARGES: True,
|
||||
PortEftOptions.MUTATIONS: True,
|
||||
PortEftOptions.IMPLANTS: True,
|
||||
PortEftOptions.BOOSTERS: True,
|
||||
PortEftOptions.CARGO: True,
|
||||
}
|
||||
settings = SettingsProvider.getInstance().getSettings("pyfaExport", {"format": CopySelectDialog.copyFormatEft, "options": {CopySelectDialog.copyFormatEft: defaultOptions}})
|
||||
options = settings["options"].get(CopySelectDialog.copyFormatEft, defaultOptions)
|
||||
|
||||
def copyToClipboard(text):
|
||||
toClipboard(text)
|
||||
|
||||
Port.exportEft(fit, options, callback=copyToClipboard)
|
||||
|
||||
def exportToClipboard(self, event):
|
||||
with CopySelectDialog(self) as dlg:
|
||||
dlg.ShowModal()
|
||||
|
||||
@@ -58,6 +58,8 @@ class MainMenuBar(wx.MenuBar):
|
||||
self.toggleIgnoreRestrictionID = wx.NewId()
|
||||
self.devToolsId = wx.NewId()
|
||||
self.optimizeFitPrice = wx.NewId()
|
||||
self.copyWithDialogId = wx.NewId()
|
||||
self.copyDirectEftId = wx.NewId()
|
||||
|
||||
self.mainFrame = mainFrame
|
||||
wx.MenuBar.__init__(self)
|
||||
@@ -85,7 +87,8 @@ class MainMenuBar(wx.MenuBar):
|
||||
fitMenu.Append(wx.ID_REDO, _t("&Redo") + "\tCTRL+Y", _t("Redo the most recent undone action"))
|
||||
|
||||
fitMenu.AppendSeparator()
|
||||
fitMenu.Append(wx.ID_COPY, _t("&To Clipboard") + "\tCTRL+C", _t("Export a fit to the clipboard"))
|
||||
fitMenu.Append(self.copyDirectEftId, _t("&To Clipboard (EFT)") + "\tCTRL+C", _t("Export a fit to the clipboard in EFT format"))
|
||||
fitMenu.Append(self.copyWithDialogId, _t("&To Clipboard (Select Format)") + "\tCTRL+SHIFT+C", _t("Export a fit to the clipboard with format selection"))
|
||||
fitMenu.Append(wx.ID_PASTE, _t("&From Clipboard") + "\tCTRL+V", _t("Import a fit from the clipboard"))
|
||||
|
||||
fitMenu.AppendSeparator()
|
||||
@@ -178,7 +181,8 @@ class MainMenuBar(wx.MenuBar):
|
||||
return
|
||||
enable = activeFitID is not None
|
||||
self.Enable(wx.ID_SAVEAS, enable)
|
||||
self.Enable(wx.ID_COPY, enable)
|
||||
self.Enable(self.copyDirectEftId, enable)
|
||||
self.Enable(self.copyWithDialogId, enable)
|
||||
self.Enable(self.exportSkillsNeededId, enable)
|
||||
self.Enable(self.copySkillsNeededId, enable)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user