mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 06:30:52 +10:00
GUI: Add error handling for object deletion
This commit is contained in:
@@ -97,7 +97,6 @@ class BuildFrame(wx.Frame):
|
|||||||
)
|
)
|
||||||
dialog.SetYesNoLabels("Install to disk", "View build log")
|
dialog.SetYesNoLabels("Install to disk", "View build log")
|
||||||
|
|
||||||
|
|
||||||
self.on_install() if dialog.ShowModal() == wx.ID_YES else self.install_button.Enable()
|
self.on_install() if dialog.ShowModal() == wx.ID_YES else self.install_button.Enable()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ from resources import constants
|
|||||||
from resources.wx_gui import (
|
from resources.wx_gui import (
|
||||||
gui_main_menu,
|
gui_main_menu,
|
||||||
gui_build,
|
gui_build,
|
||||||
gui_menubar,
|
|
||||||
gui_install_oc,
|
gui_install_oc,
|
||||||
gui_sys_patch
|
gui_sys_patch,
|
||||||
|
gui_support
|
||||||
)
|
)
|
||||||
from resources.sys_patch import sys_patch_detect
|
from resources.sys_patch import sys_patch_detect
|
||||||
|
|
||||||
@@ -53,7 +53,8 @@ class EntryPoint:
|
|||||||
screen_location=None,
|
screen_location=None,
|
||||||
**({"patches": patches} if "--gui_patch" in sys.argv or "--gui_unpatch" in sys.argv else {})
|
**({"patches": patches} if "--gui_patch" in sys.argv or "--gui_unpatch" in sys.argv else {})
|
||||||
)
|
)
|
||||||
self.frame.SetMenuBar(gui_menubar.GenerateMenubar().generate())
|
if self.frame:
|
||||||
|
self.frame.SetMenuBar(gui_support.GenerateMenubar().generate())
|
||||||
atexit.register(self.OnCloseFrame)
|
atexit.register(self.OnCloseFrame)
|
||||||
|
|
||||||
if "--gui_patch" in sys.argv:
|
if "--gui_patch" in sys.argv:
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
# Generates menubar for wxPython to use
|
|
||||||
|
|
||||||
import wx
|
|
||||||
|
|
||||||
class GenerateMenubar:
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self.menubar: wx.MenuBar = None
|
|
||||||
|
|
||||||
|
|
||||||
def generate(self) -> wx.MenuBar:
|
|
||||||
self.menubar = wx.MenuBar()
|
|
||||||
|
|
||||||
return self.menubar
|
|
||||||
@@ -10,6 +10,17 @@ from pathlib import Path
|
|||||||
from resources import constants
|
from resources import constants
|
||||||
|
|
||||||
|
|
||||||
|
class GenerateMenubar:
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.menubar: wx.MenuBar = None
|
||||||
|
|
||||||
|
|
||||||
|
def generate(self) -> wx.MenuBar:
|
||||||
|
self.menubar = wx.MenuBar()
|
||||||
|
return self.menubar
|
||||||
|
|
||||||
|
|
||||||
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:
|
||||||
|
|||||||
@@ -36,13 +36,12 @@ class SysPatchMenu(wx.Frame):
|
|||||||
self.return_button: wx.Button = None
|
self.return_button: wx.Button = None
|
||||||
|
|
||||||
self.frame_modal = wx.Dialog(self, title=title, size=(360, 200))
|
self.frame_modal = wx.Dialog(self, title=title, size=(360, 200))
|
||||||
|
self.SetPosition(screen_location) if screen_location else self.Centre()
|
||||||
|
|
||||||
if patches:
|
if patches:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._generate_elements_display_patches(self.frame_modal, patches)
|
self._generate_elements_display_patches(self.frame_modal, patches)
|
||||||
|
|
||||||
self.SetPosition(screen_location) if screen_location else self.Centre()
|
|
||||||
self.frame_modal.ShowWindowModal()
|
self.frame_modal.ShowWindowModal()
|
||||||
|
|
||||||
|
|
||||||
@@ -260,8 +259,9 @@ class SysPatchMenu(wx.Frame):
|
|||||||
else:
|
else:
|
||||||
if patches["Validation: Patching Possible"] is False:
|
if patches["Validation: Patching Possible"] is False:
|
||||||
start_button.Disable()
|
start_button.Disable()
|
||||||
if patches["Validation: Unpatching Possible"] is False:
|
if can_unpatch is False:
|
||||||
revert_button.Disable()
|
revert_button.Disable()
|
||||||
|
|
||||||
|
|
||||||
# Relaunch as root if not root
|
# Relaunch as root if not root
|
||||||
uid = os.geteuid()
|
uid = os.geteuid()
|
||||||
|
|||||||
Reference in New Issue
Block a user