GUI: Remove unused import

This commit is contained in:
Mykola Grymalyuk
2023-05-14 23:47:50 -06:00
parent 9993436029
commit 4ad65f00b5
12 changed files with 171 additions and 89 deletions
+12 -7
View File
@@ -1,7 +1,8 @@
# Entry point for the wxPython GUI
import wx
import sys
import logging
import atexit
import logging
from resources import constants
from resources.wx_gui import (
@@ -14,21 +15,23 @@ from resources.wx_gui import (
)
from resources.sys_patch import sys_patch_detect
class SupportedEntryPoints:
"""
Enum for supported entry points
"""
MAIN_MENU = gui_main_menu.MainMenu
MAIN_MENU = gui_main_menu.MainFrame
BUILD_OC = gui_build.BuildFrame
INSTALL_OC = gui_install_oc.InstallOCFrame
SYS_PATCH = gui_sys_patch.SysPatchMenu
SYS_PATCH = gui_sys_patch.SysPatchFrame
UPDATE_APP = gui_update.UpdateFrame
class EntryPoint:
def __init__(self, global_constants: constants.Constants) -> None:
self.app: wx.App = None
self.main_menu_frame: gui_main_menu.MainMenu = None
self.main_menu_frame: gui_main_menu.MainFrame = None
self.constants: constants.Constants = global_constants
self.constants.gui_mode = True
@@ -38,16 +41,17 @@ class EntryPoint:
self.app = wx.App()
def start(self, entry: SupportedEntryPoints = gui_main_menu.MainMenu) -> None:
def start(self, entry: SupportedEntryPoints = gui_main_menu.MainFrame) -> None:
"""
Launches entry point for the wxPython GUI
"""
self._generate_base_data()
if "--gui_patch" in sys.argv or "--gui_unpatch" in sys.argv:
entry = gui_sys_patch.SysPatchMenu
entry = gui_sys_patch.SysPatchFrame
patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set()
logging.info(f"- Loading wxPython GUI: {entry.__name__}")
self.frame: wx.Frame = entry(
None,
title=f"{self.constants.patcher_name} ({self.constants.patcher_version})",
@@ -57,6 +61,7 @@ class EntryPoint:
)
if self.frame:
self.frame.SetMenuBar(gui_support.GenerateMenubar().generate())
atexit.register(self.OnCloseFrame)
if "--gui_patch" in sys.argv:
@@ -67,7 +72,7 @@ class EntryPoint:
self.app.MainLoop()
def OnCloseFrame(self, event: wx.Event = None):
def OnCloseFrame(self, event: wx.Event = None) -> None:
"""
Closes the wxPython GUI
"""