From aaf7519e942423a46d7a68b2ac4c767e76cf624e Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sun, 7 May 2023 12:50:37 -0600 Subject: [PATCH] GUI: Remove unused RedirectText class --- resources/wx_gui/gui_support.py | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/resources/wx_gui/gui_support.py b/resources/wx_gui/gui_support.py index 49dc9412b..d4e029e12 100644 --- a/resources/wx_gui/gui_support.py +++ b/resources/wx_gui/gui_support.py @@ -3,13 +3,13 @@ import time import sys import time import logging - import subprocess from pathlib import Path from resources import constants + class PayloadMount: def __init__(self, global_constants: constants.Constants, frame: wx.Frame) -> None: @@ -37,38 +37,19 @@ class PayloadMount: class ThreadHandler(logging.Handler): + """ + Reroutes logging output to a wx.TextCtrl using UI callbacks + """ def __init__(self, text_box: wx.TextCtrl): logging.Handler.__init__(self) self.text_box = text_box - def emit(self, record): + def emit(self, record: logging.LogRecord): wx.CallAfter(self.text_box.AppendText, self.format(record) + '\n') -class RedirectText(object): - """ - Redirects stdout to a wxPython TextCtrl - """ - - def __init__(self, aWxTextCtrl: wx.TextCtrl, sleep: bool): - self.out = aWxTextCtrl - self.sleep = sleep - - def write(self,string): - self.out.WriteText(string) - wx.GetApp().Yield() - if self.sleep: - time.sleep(0.01) - - def fileno(self): - return 1 - - def flush(self): - pass - - class RestartHost: """ Restarts the host machine @@ -118,7 +99,6 @@ class RelaunchApplicationAsRoot: logging.info("User cancelled relaunch") return - timer: int = 5 program_arguments: str = "" @@ -175,4 +155,5 @@ class RelaunchApplicationAsRoot: timer -= 1 if timer == 0: break + sys.exit(0) \ No newline at end of file