diff --git a/plugins/plugin.py b/plugins/plugin.py index 911a8ff..91b9bb8 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -84,6 +84,16 @@ class KiCadToJLCForm(wx.Frame): self.Centre(wx.BOTH) + # Bind the ESC key event to a handler + self.Bind(wx.EVT_CHAR_HOOK, self.onKey) + + # Close the dialog when pressing the ESC key + def onKey(self, event): + if event.GetKeyCode() == wx.WXK_ESCAPE: + self.Close(True) + else: + event.Skip() + def onGenerateButtonClick(self, event): options = dict()