From 18d8ed6558ecefd91674706baeab0ab74e0a6422 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 8 Oct 2019 20:50:14 +0300 Subject: [PATCH] Take modifier key info from event where possible --- graphs/gui/frame.py | 4 +--- graphs/gui/lists.py | 8 ++++---- gui/builtinAdditionPanes/boosterView.py | 8 ++++---- gui/builtinAdditionPanes/cargoView.py | 8 ++++---- gui/builtinAdditionPanes/commandView.py | 8 ++++---- gui/builtinAdditionPanes/droneView.py | 12 ++++++------ gui/builtinAdditionPanes/fighterView.py | 11 +++++------ gui/builtinAdditionPanes/implantView.py | 8 ++++---- gui/builtinAdditionPanes/projectedView.py | 12 ++++++------ gui/builtinContextMenus/itemStats.py | 3 +-- gui/builtinContextMenus/moduleAmmoChange.py | 3 +-- gui/builtinShipBrowser/fitItem.py | 4 +--- gui/builtinShipBrowser/navigationPanel.py | 6 +++--- gui/builtinShipBrowser/shipItem.py | 4 +--- gui/builtinViews/fittingView.py | 8 ++++---- gui/characterEditor.py | 4 +--- gui/esiFittings.py | 12 +++--------- gui/itemStats.py | 4 +--- gui/patternEditor.py | 4 +--- gui/preferenceDialog.py | 4 +--- gui/propertyEditor.py | 4 +--- gui/setEditor.py | 4 +--- gui/targetProfileEditor.py | 4 +--- 23 files changed, 59 insertions(+), 88 deletions(-) diff --git a/graphs/gui/frame.py b/graphs/gui/frame.py index cfb311edb..47261c292 100644 --- a/graphs/gui/frame.py +++ b/graphs/gui/frame.py @@ -116,9 +116,7 @@ class GraphFrame(AuxiliaryFrame): self.SetMinSize(newSize) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/graphs/gui/lists.py b/graphs/gui/lists.py index a4ba0b947..6b7cd860e 100644 --- a/graphs/gui/lists.py +++ b/graphs/gui/lists.py @@ -152,10 +152,10 @@ class BaseWrapperList(gui.display.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + modifiers = event.GetModifiers() + if keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: self.removeWrappers(self.getSelectedWrappers()) event.Skip() @@ -297,7 +297,7 @@ class SourceWrapperList(BaseWrapperList): def spawnMenu(self, event): clickedPos = self.getRowByAbs(event.Position) - self.ensureSelection(clickedPos) + self.ensureSelection(clickedPos, event) selection = self.getSelectedWrappers() mainItem = self.getWrapper(clickedPos) diff --git a/gui/builtinAdditionPanes/boosterView.py b/gui/builtinAdditionPanes/boosterView.py index 60785b73f..5b17515a9 100644 --- a/gui/builtinAdditionPanes/boosterView.py +++ b/gui/builtinAdditionPanes/boosterView.py @@ -88,12 +88,12 @@ class BoosterView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: boosters = self.getSelectedBoosters() self.removeBoosters(boosters) event.Skip() diff --git a/gui/builtinAdditionPanes/cargoView.py b/gui/builtinAdditionPanes/cargoView.py index ce133fc00..e28a1c3eb 100644 --- a/gui/builtinAdditionPanes/cargoView.py +++ b/gui/builtinAdditionPanes/cargoView.py @@ -104,12 +104,12 @@ class CargoView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: cargos = self.getSelectedCargos() self.removeCargos(cargos) event.Skip() diff --git a/gui/builtinAdditionPanes/commandView.py b/gui/builtinAdditionPanes/commandView.py index 2499d051c..272c51d8a 100644 --- a/gui/builtinAdditionPanes/commandView.py +++ b/gui/builtinAdditionPanes/commandView.py @@ -102,12 +102,12 @@ class CommandView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: commandFits = self.getSelectedCommandFits() self.removeCommandFits(commandFits) event.Skip() diff --git a/gui/builtinAdditionPanes/droneView.py b/gui/builtinAdditionPanes/droneView.py index 105e4710f..d5afa33e3 100644 --- a/gui/builtinAdditionPanes/droneView.py +++ b/gui/builtinAdditionPanes/droneView.py @@ -120,12 +120,12 @@ class DroneView(Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: drones = self.getSelectedDrones() self.removeDroneStacks(drones) event.Skip() @@ -245,7 +245,7 @@ class DroneView(Display): event.Skip() return - amount = droneStackLimit(fit, event.itemID) if wx.GetMouseState().GetModifiers() == wx.MOD_ALT else 1 + amount = droneStackLimit(fit, event.itemID) if event.GetModifiers() == wx.MOD_ALT else 1 if self.mainFrame.command.Submit(cmd.GuiAddLocalDroneCommand(fitID=fitID, itemID=event.itemID, amount=amount)): self.mainFrame.additionsPane.select('Drones') @@ -260,7 +260,7 @@ class DroneView(Display): drone = self.drones[row] except IndexError: return - if wx.GetMouseState().GetModifiers() == wx.MOD_ALT: + if event.GetModifiers() == wx.MOD_ALT: self.removeDroneStacks([drone]) else: self.removeDrone(drone) diff --git a/gui/builtinAdditionPanes/fighterView.py b/gui/builtinAdditionPanes/fighterView.py index d6348a978..d37346b3f 100644 --- a/gui/builtinAdditionPanes/fighterView.py +++ b/gui/builtinAdditionPanes/fighterView.py @@ -205,12 +205,12 @@ class FighterDisplay(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: fighters = self.getSelectedFighters() self.removeFighters(fighters) event.Skip() @@ -315,12 +315,11 @@ class FighterDisplay(d.Display): if row != -1: col = self.getColumn(event.Position) if col != self.getColIndex(State): - mstate = wx.GetMouseState() try: fighter = self.fighters[row] except IndexError: return - if mstate.GetModifiers() == wx.MOD_ALT: + if event.GetModifiers() == wx.MOD_ALT: fighters = getSimilarFighters(self.original, fighter) else: fighters = [fighter] diff --git a/gui/builtinAdditionPanes/implantView.py b/gui/builtinAdditionPanes/implantView.py index 7bcd35379..e608e6ec1 100644 --- a/gui/builtinAdditionPanes/implantView.py +++ b/gui/builtinAdditionPanes/implantView.py @@ -162,12 +162,12 @@ class ImplantDisplay(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: implants = self.getSelectedImplants() self.removeImplants(implants) event.Skip() diff --git a/gui/builtinAdditionPanes/projectedView.py b/gui/builtinAdditionPanes/projectedView.py index 06fb38972..a87646ad9 100644 --- a/gui/builtinAdditionPanes/projectedView.py +++ b/gui/builtinAdditionPanes/projectedView.py @@ -129,12 +129,12 @@ class ProjectedView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand( fitID=self.mainFrame.getActiveFit(), items=self.getSelectedProjectors(), @@ -267,7 +267,7 @@ class ProjectedView(d.Display): selection = self.getSelectedProjectors() if mainItem not in selection: selection = [mainItem] - modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT + modPressed = event.GetModifiers() == wx.MOD_ALT fitID = self.mainFrame.getActiveFit() if isinstance(mainItem, EosModule) and modPressed: fit = Fit.getInstance().getFit(fitID) @@ -342,7 +342,7 @@ class ProjectedView(d.Display): if mainItem is None: return fitID = self.mainFrame.getActiveFit() - modPressed = wx.GetMouseState().GetModifiers() == wx.MOD_ALT + modPressed = event.GetModifiers() == wx.MOD_ALT if isinstance(mainItem, EosFit): self.mainFrame.command.Submit(cmd.GuiRemoveProjectedItemsCommand( fitID=fitID, items=[mainItem], amount=math.inf if modPressed else 1)) diff --git a/gui/builtinContextMenus/itemStats.py b/gui/builtinContextMenus/itemStats.py index 0707d1f30..dabac9d5f 100644 --- a/gui/builtinContextMenus/itemStats.py +++ b/gui/builtinContextMenus/itemStats.py @@ -48,10 +48,9 @@ class ItemStats(ContextMenuSingle): if srcContext == "fittingModule" and stuff.isEmpty: return - mstate = wx.GetMouseState() reuse = False - if mstate.GetModifiers() == wx.MOD_SHIFT: + if wx.GetMouseState().GetModifiers() == wx.MOD_SHIFT: reuse = True if self.mainFrame.GetActiveStatsWindow() is None and reuse: diff --git a/gui/builtinContextMenus/moduleAmmoChange.py b/gui/builtinContextMenus/moduleAmmoChange.py index 1918ad58d..bdcf2dc6e 100644 --- a/gui/builtinContextMenus/moduleAmmoChange.py +++ b/gui/builtinContextMenus/moduleAmmoChange.py @@ -226,9 +226,8 @@ class ChangeModuleAmmo(ContextMenuCombined): fitID = self.mainFrame.getActiveFit() sFit = Fit.getInstance() fit = sFit.getFit(fitID) - mstate = wx.GetMouseState() # Switch in selection or all modules, depending on modifier key state and settings - switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (mstate.GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL)) + switchAll = sFit.serviceFittingOptions['ammoChangeAll'] is not (wx.GetMouseState().GetModifiers() in (wx.MOD_ALT, wx.MOD_CONTROL)) if switchAll: if self.srcContext == 'fittingModule': command = cmd.GuiChangeLocalModuleChargesCommand diff --git a/gui/builtinShipBrowser/fitItem.py b/gui/builtinShipBrowser/fitItem.py index dfb403cb8..2187930fc 100644 --- a/gui/builtinShipBrowser/fitItem.py +++ b/gui/builtinShipBrowser/fitItem.py @@ -283,9 +283,7 @@ class FitItem(SFItem.SFBrowserItem): event.Skip() def editCheckEsc(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.RestoreEditButton() else: event.Skip() diff --git a/gui/builtinShipBrowser/navigationPanel.py b/gui/builtinShipBrowser/navigationPanel.py index bbded1f8f..1df80bd0d 100644 --- a/gui/builtinShipBrowser/navigationPanel.py +++ b/gui/builtinShipBrowser/navigationPanel.py @@ -109,10 +109,10 @@ class NavigationPanel(SFItem.SFBrowserItem): def OnBrowserSearchBoxKeyPress(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.BrowserSearchBox.Show(False) - elif event.RawControlDown() and event.GetKeyCode() == wx.WXK_BACK: + elif keycode == wx.WXK_BACK and modifiers == wx.MOD_CONTROL: HandleCtrlBackspace(self.BrowserSearchBox) else: event.Skip() diff --git a/gui/builtinShipBrowser/shipItem.py b/gui/builtinShipBrowser/shipItem.py index 21ed999d7..e0eae64b0 100644 --- a/gui/builtinShipBrowser/shipItem.py +++ b/gui/builtinShipBrowser/shipItem.py @@ -176,9 +176,7 @@ class ShipItem(SFItem.SFBrowserItem): self.Refresh() def editCheckEsc(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.tcFitName.Show(False) else: event.Skip() diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 349afbafb..9025586d0 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -280,12 +280,12 @@ class FittingView(d.Display): def kbEvent(self, event): keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + modifiers = event.GetModifiers() + if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE: self.unselectAll() - elif keycode == 65 and mstate.GetModifiers() == wx.MOD_CONTROL: + elif keycode == 65 and modifiers == wx.MOD_CONTROL: self.selectAll() - elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and mstate.GetModifiers() == wx.MOD_NONE: + elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE: modules = [m for m in self.getSelectedMods() if not m.isEmpty] self.removeModule(modules) event.Skip() diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 52210d4b5..9af767acc 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -258,9 +258,7 @@ class CharacterEditor(AuxiliaryFrame): wx.PostEvent(self, GE.CharListUpdated()) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/esiFittings.py b/gui/esiFittings.py index a94c362e5..22dec7a4f 100644 --- a/gui/esiFittings.py +++ b/gui/esiFittings.py @@ -92,9 +92,7 @@ class EveFittings(AuxiliaryFrame): self.charChoice.SetSelection(0) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() @@ -248,9 +246,7 @@ class ExportToEve(AuxiliaryFrame): self.charChoice.SetSelection(0) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() @@ -358,9 +354,7 @@ class SsoCharacterMgmt(AuxiliaryFrame): event.Skip() def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/itemStats.py b/gui/itemStats.py index 62667befe..284121ecc 100644 --- a/gui/itemStats.py +++ b/gui/itemStats.py @@ -133,9 +133,7 @@ class ItemStatsFrame(AuxiliaryFrame): self.parentWnd.SetActiveStatsWindow(self) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 9ce5e7c2c..ee22d3fd1 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -281,9 +281,7 @@ class DmgPatternEditor(AuxiliaryFrame): self.stNotice.SetLabel("Patterns exported to clipboard") def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index ae0b68824..cfee57b4f 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -81,9 +81,7 @@ class PreferenceDialog(wx.Dialog): self.Close() def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/propertyEditor.py b/gui/propertyEditor.py index d5b827bbf..2292c5ac5 100644 --- a/gui/propertyEditor.py +++ b/gui/propertyEditor.py @@ -89,9 +89,7 @@ class AttributeEditor(AuxiliaryFrame): self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent) def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/setEditor.py b/gui/setEditor.py index 5af95f35b..578cf18fd 100644 --- a/gui/setEditor.py +++ b/gui/setEditor.py @@ -185,9 +185,7 @@ class ImplantSetEditor(AuxiliaryFrame): return def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip() diff --git a/gui/targetProfileEditor.py b/gui/targetProfileEditor.py index 0112ef73f..244aec20b 100644 --- a/gui/targetProfileEditor.py +++ b/gui/targetProfileEditor.py @@ -369,9 +369,7 @@ class TargetProfileEditor(AuxiliaryFrame): self.stNotice.SetLabel("Profiles exported to clipboard") def kbEvent(self, event): - keycode = event.GetKeyCode() - mstate = wx.GetMouseState() - if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE: + if event.GetKeyCode() == wx.WXK_ESCAPE and event.GetModifiers() == wx.MOD_NONE: self.Close() return event.Skip()