Skip to content

Commit a5d2fe5

Browse files
authored
Add Ctrl-Q/Command-Q to quit (#12)
* add menu with quit * add comment * don't add unnecessary File menu for macos
1 parent ca46611 commit a5d2fe5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

esphomeflasher/gui.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ class MainFrame(wx.Frame):
190190
def __init__(self, parent, title):
191191
wx.Frame.__init__(self, parent, -1, title, style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
192192

193+
# Add menu with quit option
194+
menubar = wx.MenuBar()
195+
file_menu = wx.Menu()
196+
quit_item = file_menu.Append(
197+
wx.ID_EXIT, "Quit\tCtrl-Q" if sys.platform != "darwin" else "Quit\tCmd-Q", "Quit FujiNet-Flasher")
198+
if sys.platform != "darwin":
199+
menubar.Append(file_menu, "&File")
200+
self.SetMenuBar(menubar)
201+
self.Bind(wx.EVT_MENU, self._on_exit_app, quit_item)
202+
193203
self._firmware = None
194204
self._port = None
195205
self._upload_baud_rate = 460800

0 commit comments

Comments
 (0)