GUI: Remove unused RedirectText class

This commit is contained in:
Mykola Grymalyuk
2023-05-07 12:50:37 -06:00
parent 28cdc3f61b
commit aaf7519e94
+6 -25
View File
@@ -3,13 +3,13 @@ import time
import sys import sys
import time import time
import logging import logging
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from resources import constants from resources import constants
class PayloadMount: class PayloadMount:
def __init__(self, global_constants: constants.Constants, frame: wx.Frame) -> None: def __init__(self, global_constants: constants.Constants, frame: wx.Frame) -> None:
@@ -37,38 +37,19 @@ class PayloadMount:
class ThreadHandler(logging.Handler): class ThreadHandler(logging.Handler):
"""
Reroutes logging output to a wx.TextCtrl using UI callbacks
"""
def __init__(self, text_box: wx.TextCtrl): def __init__(self, text_box: wx.TextCtrl):
logging.Handler.__init__(self) logging.Handler.__init__(self)
self.text_box = text_box 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') 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: class RestartHost:
""" """
Restarts the host machine Restarts the host machine
@@ -118,7 +99,6 @@ class RelaunchApplicationAsRoot:
logging.info("User cancelled relaunch") logging.info("User cancelled relaunch")
return return
timer: int = 5 timer: int = 5
program_arguments: str = "" program_arguments: str = ""
@@ -175,4 +155,5 @@ class RelaunchApplicationAsRoot:
timer -= 1 timer -= 1
if timer == 0: if timer == 0:
break break
sys.exit(0) sys.exit(0)