From b2580aac940fa727c05c81057ca58fa6be509791 Mon Sep 17 00:00:00 2001 From: Connor Howell Date: Sun, 23 Oct 2022 17:14:29 +0100 Subject: [PATCH] Add logging mode sub menu (#79) --- VW_Flash_GUI.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/VW_Flash_GUI.py b/VW_Flash_GUI.py index de97439..5c62849 100644 --- a/VW_Flash_GUI.py +++ b/VW_Flash_GUI.py @@ -745,6 +745,18 @@ def create_menu(self): self.Bind( event=wx.EVT_MENU, handler=self.on_stop_logger, source=logger_stop_menu_item ) + + logging_modes = ["22", "3E", "HSL"] + logging_modes_menu = wx.Menu() + for mode in logging_modes: + radio_item = logging_modes_menu.AppendRadioItem(wx.ID_ANY, mode, "Logging Mode: "+mode) + radio_item.Check(self.panel.options.get('logmode', "22") == mode) + + self.Bind( + wx.EVT_MENU, lambda evt, temp=mode: self.on_select_logging_mode(evt, temp), source=radio_item + ) + + logger_menu.AppendSubMenu(logging_modes_menu, "&Logging Mode", "Select Logging Mode") menu_bar.Append(logger_menu, "&Logger") self.SetMenuBar(menu_bar) @@ -757,6 +769,10 @@ def on_open_folder(self, event): self.panel.update_bin_listing() dlg.Destroy() + def on_select_logging_mode(self, event, mode): + self.panel.options["logmode"] = mode + write_config(self.panel.options) + def on_select_scanble(self, event): self.panel.options["scanble"] = event.IsChecked() write_config(self.panel.options)