From f9fd265280463007c45091c847f71ea5733bf511 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 18 Apr 2019 11:34:16 +0300 Subject: [PATCH] Add option which controls ammo switcher behavior --- gui/builtinContextMenus/moduleAmmoChange.py | 8 +++++--- .../pyfaGeneralPreferences.py | 15 +++++++++++++++ service/fit.py | 3 ++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/gui/builtinContextMenus/moduleAmmoChange.py b/gui/builtinContextMenus/moduleAmmoChange.py index 8e1b38ce4..9c167cb69 100644 --- a/gui/builtinContextMenus/moduleAmmoChange.py +++ b/gui/builtinContextMenus/moduleAmmoChange.py @@ -220,9 +220,11 @@ class ChangeModuleAmmo(ContextMenu): return fitID = self.mainFrame.getActiveFit() - # Set to all modules if ctrl is pressed - if wx.GetMouseState().CmdDown(): - fit = Fit.getInstance().getFit(fitID) + sFit = Fit.getInstance() + switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not wx.GetMouseState().CmdDown() + # Switch in selection or all modules, depending on ctrl key state and settings + if switchAll: + fit = sFit.getFit(fitID) selectedModule = self.modules[0] if self.context == 'fittingModule': self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleChargesCommand( diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 262b119a0..7392b6086 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -27,6 +27,7 @@ class PFGeneralPref(PreferenceView): self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) + helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) mainSizer.Add(self.stTitle, 0, wx.ALL, 5) self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) @@ -78,6 +79,15 @@ class PFGeneralPref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowShipBrowserTooltip, 0, wx.ALL | wx.EXPAND, 5) + + self.cbReloadAll = wx.CheckBox(panel, wx.ID_ANY, "Change charge in all modules of the same type", + wx.DefaultPosition, wx.DefaultSize, 0) + if "wxGTK" not in wx.PlatformInfo: + self.cbReloadAll.SetCursor(helpCursor) + self.cbReloadAll.SetToolTip(wx.ToolTip( + 'When disabled, reloads charges just in selected modules. Action can be reversed by holding Ctrl key while changing charge.')) + mainSizer.Add(self.cbReloadAll, 0, wx.ALL | wx.EXPAND, 5) + self.sFit = Fit.getInstance() self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"]) @@ -92,6 +102,7 @@ class PFGeneralPref(PreferenceView): self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"]) self.cbOpenFitInNew.SetValue(self.sFit.serviceFittingOptions["openFitInNew"]) self.cbShowShipBrowserTooltip.SetValue(self.sFit.serviceFittingOptions["showShipBrowserTooltip"]) + self.cbReloadAll.SetValue(self.sFit.serviceFittingOptions["ammoChangeAll"]) self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbDefaultCharImplants.Bind(wx.EVT_CHECKBOX, self.OnCBDefaultCharImplantsStateChange) @@ -105,6 +116,7 @@ class PFGeneralPref(PreferenceView): self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation) self.cbOpenFitInNew.Bind(wx.EVT_CHECKBOX, self.onCBOpenFitInNew) self.cbShowShipBrowserTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowShipBrowserTooltip) + self.cbReloadAll.Bind(wx.EVT_CHECKBOX, self.onCBReloadAll) self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False) @@ -174,6 +186,9 @@ class PFGeneralPref(PreferenceView): def onCBShowShipBrowserTooltip(self, event): self.sFit.serviceFittingOptions["showShipBrowserTooltip"] = self.cbShowShipBrowserTooltip.GetValue() + def onCBReloadAll(self, event): + self.sFit.serviceFittingOptions["ammoChangeAll"] = self.cbReloadAll.GetValue() + def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui") diff --git a/service/fit.py b/service/fit.py index 976f5575e..580520a43 100644 --- a/service/fit.py +++ b/service/fit.py @@ -92,7 +92,8 @@ class Fit(FitDeprecated): "priceSystem": "Jita", "priceSource": "eve-marketdata.com", "showShipBrowserTooltip": True, - "marketSearchDelay": 250 + "marketSearchDelay": 250, + "ammoChangeAll": False, } self.serviceFittingOptions = SettingsProvider.getInstance().getSettings(