From 88374c1b96c1fa334caa310bf6f66a250daf121b Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Thu, 19 May 2022 15:39:12 -0600 Subject: [PATCH] gui_main.py: Lower count down for relaunch to 5s With newly optimized binary, no longer need to present the GUI for as long --- gui/gui_main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/gui_main.py b/gui/gui_main.py index 4d09e3978..3c7375440 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -75,7 +75,7 @@ class wx_python_gui: wx.CallAfter(self.frame.Close) - def OnCloseFrame(self, event): + def OnCloseFrame(self, event=None): self.frame.SetTransparent(0) wx.GetApp().Yield() self.frame.DestroyChildren() @@ -95,7 +95,7 @@ class wx_python_gui: if answer == wx.ID_YES: # Reboots with Count Down prompt (user can still dismiss if needed) subprocess.call(['osascript', '-e', 'tell app "loginwindow" to «event aevtrrst»']) - sys.exit(0) + self.OnCloseFrame(event) def reset_window(self): self.frame.DestroyChildren() @@ -205,6 +205,7 @@ class wx_python_gui: if self.dialog.ShowModal() == wx.ID_YES: print("Relaunching as root") + timer_val = 5 extension = "" if event: if event.GetEventObject() != wx.Menu: @@ -236,7 +237,7 @@ class wx_python_gui: self.header.Centre(wx.HORIZONTAL) # Add count down label - self.countdown_label = wx.StaticText(self.frame, label="Closing old process in 15 seconds") + self.countdown_label = wx.StaticText(self.frame, label=f"Closing old process in {timer_val} seconds") self.countdown_label.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) # Set below header self.countdown_label.SetPosition( @@ -272,7 +273,6 @@ class wx_python_gui: stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) - timer_val = 15 while True: wx.GetApp().Yield() self.countdown_label.SetLabel(f"Closing old process in {timer_val} seconds") @@ -281,7 +281,7 @@ class wx_python_gui: if timer_val == 0: break # Close Current Application - self.frame.Close() + self.OnCloseFrame(event) def not_yet_implemented_menu(self, event=None): self.frame.DestroyChildren()