From 91cb6e4ecfdd7c776b769dc2ea48764cd508f127 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 26 Oct 2022 17:22:27 -0600 Subject: [PATCH] build.py: Add Timeout customization --- CHANGELOG.md | 1 + gui/gui_main.py | 21 ++++++++++++++++++++- resources/build.py | 3 +++ resources/constants.py | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6d629a5..2ab17f55d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - ex. Allow 13.0 KDK on 13.1 - Clean out `/Library/Extensions` on KDK-less root patches - Ensures old, incompatible kexts are not linked against +- Add OpenCore Picker timeout selection ## 0.5.0 - Ventura Specific Updates: diff --git a/gui/gui_main.py b/gui/gui_main.py index 8f2aaa15e..e8b96e439 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -2459,13 +2459,29 @@ class wx_python_gui: if (not self.constants.custom_model and self.computer.real_model not in models) or (self.constants.custom_model and self.constants.custom_model not in models): self.gpu_dropdown.Disable() + # OpenCore Picker Timeout (using wxSpinCtrl) + # Label: Picker Timeout + self.label_timeout = wx.StaticText(self.frame_modal, label="Picker Timeout (seconds):", style=wx.ALIGN_CENTRE) + self.label_timeout.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) + self.label_timeout.SetPosition(wx.Point(0, self.gpu_dropdown.GetPosition().y + self.gpu_dropdown.GetSize().height + 2)) + self.label_timeout.SetSize(wx.Size(self.frame_modal.GetSize().width, 30)) + self.label_timeout.Centre(wx.HORIZONTAL) + + # Picker Timeout + self.timeout_spinner = wx.SpinCtrl(self.frame_modal, value=f"{self.constants.oc_timeout}", min=0, max=60) + self.timeout_spinner.SetPosition(wx.Point( + self.label_timeout.GetPosition().x, + int(self.label_timeout.GetPosition().y + self.label_timeout.GetSize().height / 2))) + self.timeout_spinner.Bind(wx.EVT_SPINCTRL, self.timeout_spinner_click) + self.timeout_spinner.Centre(wx.HORIZONTAL) + # Disable Thunderbolt self.disable_thunderbolt_checkbox = wx.CheckBox(self.frame_modal, label="Disable Thunderbolt") self.disable_thunderbolt_checkbox.SetValue(self.constants.disable_tb) self.disable_thunderbolt_checkbox.Bind(wx.EVT_CHECKBOX, self.disable_tb_click) self.disable_thunderbolt_checkbox.SetPosition(wx.Point( 30, - self.gpu_dropdown.GetPosition().y + self.gpu_dropdown.GetSize().height + 5)) + self.timeout_spinner.GetPosition().y + self.timeout_spinner.GetSize().height + 5)) self.disable_thunderbolt_checkbox.SetToolTip(wx.ToolTip("Disables Thunderbolt support on MacBookPro11,x\nMainly applicable for systems that cannot boot with Thunderbolt enabled")) if not self.constants.custom_model and not self.computer.real_model.startswith("MacBookPro11"): self.disable_thunderbolt_checkbox.Disable() @@ -2639,6 +2655,9 @@ class wx_python_gui: self.frame_modal.SetSize(wx.Size(-1, self.return_to_main_menu_button.GetPosition().y + self.return_to_main_menu_button.GetSize().height + 40)) self.frame_modal.ShowWindowModal() + def timeout_spinner_click(self, event): + self.constants.oc_timeout = self.timeout_spinner.GetValue() + def delete_unused_kdks_click(self, event): if self.delete_unused_kdks_checkbox.GetValue() is True: print("Nuke KDKs enabled") diff --git a/resources/build.py b/resources/build.py index 711eed6a9..071c536f1 100644 --- a/resources/build.py +++ b/resources/build.py @@ -1007,6 +1007,9 @@ class BuildOpenCore: else: print("- Hiding OpenCore picker") self.config["Misc"]["Boot"]["ShowPicker"] = False + if self.constants.oc_timeout != 5: + print(f"- Setting custom OpenCore picker timeout to {self.constants.oc_timeout} seconds") + self.config["Misc"]["Boot"]["Timeout"] = self.constants.oc_timeout if self.constants.vault is True: print("- Setting Vault configuration") self.config["Misc"]["Security"]["Vault"] = "Secure" diff --git a/resources/constants.py b/resources/constants.py index d778f7571..481ad8364 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -204,6 +204,7 @@ class Constants: self.host_is_hackintosh = False # Determine if host is Hackintosh self.commit_info = (None, None, None) self.set_vmm_cpuid = False # Set VMM bit inside CPUID + self.oc_timeout = 5 # Set OpenCore timeout self.legacy_accel_support = [ os_data.os_data.big_sur,