Merge branch 'main' into sonoma-development

This commit is contained in:
Mykola Grymalyuk
2023-09-24 13:22:49 -06:00
committed by GitHub
16 changed files with 146 additions and 115 deletions

View File

@@ -56,24 +56,24 @@ class SettingsFrame(wx.Frame):
"""
notebook = wx.Notebook(frame)
notebook.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
notebook.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddSpacer(10)
model_label = wx.StaticText(frame, label="Target Model", pos=(-1, -1))
model_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
model_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
sizer.Add(model_label, 0, wx.ALIGN_CENTER | wx.ALL, 5)
model_choice = wx.Choice(frame, choices=model_array.SupportedSMBIOS + ["Host Model"], pos=(-1, -1), size=(150, -1))
model_choice.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
model_choice.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
model_choice.Bind(wx.EVT_CHOICE, lambda event: self.on_model_choice(event, model_choice))
selection = self.constants.custom_model if self.constants.custom_model else "Host Model"
model_choice.SetSelection(model_choice.FindString(selection))
sizer.Add(model_choice, 0, wx.ALIGN_CENTER | wx.ALL, 5)
model_description = wx.StaticText(frame, label="Overrides Mac Model the Patcher will build for.", pos=(-1, -1))
model_description.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
model_description.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL))
sizer.Add(model_description, 0, wx.ALIGN_CENTER | wx.ALL, 5)
tabs = list(self.settings.keys())
@@ -88,7 +88,7 @@ class SettingsFrame(wx.Frame):
# Add return button
return_button = wx.Button(frame, label="Return", pos=(-1, -1), size=(100, 30))
return_button.Bind(wx.EVT_BUTTON, self.on_return)
return_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
return_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
sizer.Add(return_button, 0, wx.ALIGN_CENTER | wx.ALL, 10)
frame.SetSizer(sizer)
@@ -127,7 +127,7 @@ class SettingsFrame(wx.Frame):
# Add title
title = wx.StaticText(panel, label=setting, pos=(-1, -1))
title.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
title.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
title.SetPosition((int(horizontal_center) - int(title.GetSize()[0] / 2) - 15, height))
highest_height_reached = height + title.GetSize()[1] + 10
@@ -137,7 +137,7 @@ class SettingsFrame(wx.Frame):
if setting_info["type"] == "sub_title":
# Add sub-title
sub_title = wx.StaticText(panel, label=setting, pos=(-1, -1))
sub_title.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
sub_title.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
sub_title.SetPosition((int(horizontal_center) - int(sub_title.GetSize()[0] / 2) - 15, height))
highest_height_reached = height + sub_title.GetSize()[1] + 10
@@ -153,7 +153,7 @@ class SettingsFrame(wx.Frame):
# Add checkbox, and description underneath
checkbox = wx.CheckBox(panel, label=setting, pos=(10 + width, 10 + height), size = (300,-1))
checkbox.SetValue(setting_info["value"] if setting_info["value"] else False)
checkbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
checkbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
event = lambda event, warning=setting_info["warning"] if "warning" in setting_info else "", override=bool(setting_info["override_function"]) if "override_function" in setting_info else False: self.on_checkbox(event, warning, override)
checkbox.Bind(wx.EVT_CHECKBOX, event)
if "condition" in setting_info:
@@ -164,20 +164,20 @@ class SettingsFrame(wx.Frame):
elif setting_info["type"] == "spinctrl":
# Add spinctrl, and description underneath
spinctrl = wx.SpinCtrl(panel, value=str(setting_info["value"]), pos=(width - 20, 10 + height), min=setting_info["min"], max=setting_info["max"], size = (45,-1))
spinctrl.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
spinctrl.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
spinctrl.Bind(wx.EVT_TEXT, lambda event, variable=setting: self.on_spinctrl(event, variable))
# Add label next to spinctrl
label = wx.StaticText(panel, label=setting, pos=(spinctrl.GetSize()[0] + width - 16, spinctrl.GetPosition()[1]))
label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
elif setting_info["type"] == "choice":
# Title
title = wx.StaticText(panel, label=setting, pos=(width + 30, 10 + height))
title.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
title.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
height += title.GetSize()[1] + 10
# Add combobox, and description underneath
choice = wx.Choice(panel, pos=(width + 25, 10 + height), choices=setting_info["choices"], size = (150,-1))
choice.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
choice.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
choice.SetSelection(choice.FindString(setting_info["value"]))
if "override_function" in setting_info:
choice.Bind(wx.EVT_CHOICE, lambda event, variable=setting: self.settings[tab][variable]["override_function"](event))
@@ -186,7 +186,7 @@ class SettingsFrame(wx.Frame):
height += 10
elif setting_info["type"] == "button":
button = wx.Button(panel, label=setting, pos=(width + 25, 10 + height), size = (200,-1))
button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
button.Bind(wx.EVT_BUTTON, lambda event, variable=setting: self.settings[tab][variable]["function"](event))
height += 10
@@ -195,7 +195,7 @@ class SettingsFrame(wx.Frame):
lines = '\n'.join(setting_info["description"])
description = wx.StaticText(panel, label=lines, pos=(30 + width, 10 + height + 20))
description.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
description.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL))
height += 40
if "condition" in setting_info:
if setting_info["condition"] is False:
@@ -910,12 +910,12 @@ class SettingsFrame(wx.Frame):
# Label: Flip individual bits corresponding to XNU's csr.h
# If you're unfamiliar with how SIP works, do not touch this menu
sip_label = wx.StaticText(panel, label="Flip individual bits corresponding to", pos=(sip_title.GetPosition()[0] - 20, sip_title.GetPosition()[1] + 30))
sip_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
sip_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
# Hyperlink: csr.h
spacer = 1 if self.constants.detected_os >= os_data.os_data.big_sur else 3
sip_csr_h = wx.adv.HyperlinkCtrl(panel, id=wx.ID_ANY, label="XNU's csr.h", url="https://github.com/apple-oss-distributions/xnu/blob/xnu-8020.101.4/bsd/sys/csr.h", pos=(sip_label.GetPosition()[0] + sip_label.GetSize()[0] + 4, sip_label.GetPosition()[1] + spacer))
sip_csr_h.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
sip_csr_h.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
sip_csr_h.SetHoverColour(self.hyperlink_colour)
sip_csr_h.SetNormalColour(self.hyperlink_colour)
sip_csr_h.SetVisitedColour(self.hyperlink_colour)
@@ -928,12 +928,12 @@ class SettingsFrame(wx.Frame):
else:
self.sip_value = 0x803
sip_configured_label = wx.StaticText(panel, label=f"Currently configured SIP: {hex(self.sip_value)}", pos=(sip_label.GetPosition()[0] + 35, sip_label.GetPosition()[1] + 20))
sip_configured_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
sip_configured_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
self.sip_configured_label = sip_configured_label
# Label: SIP Status
sip_booted_label = wx.StaticText(panel, label=f"Currently booted SIP: {hex(py_sip_xnu.SipXnu().get_sip_status().value)}", pos=(sip_configured_label.GetPosition()[0], sip_configured_label.GetPosition()[1] + 20))
sip_booted_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
sip_booted_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
# SIP toggles
@@ -943,7 +943,7 @@ class SettingsFrame(wx.Frame):
index = 1
for sip_bit in sip_data.system_integrity_protection.csr_values_extended:
self.sip_checkbox = wx.CheckBox(panel, label=sip_data.system_integrity_protection.csr_values_extended[sip_bit]["name"].split("CSR_")[1], pos = (vertical_spacer, sip_booted_label.GetPosition()[1] + 20 + horizontal_spacer))
self.sip_checkbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.sip_checkbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
self.sip_checkbox.SetToolTip(f'Description: {sip_data.system_integrity_protection.csr_values_extended[sip_bit]["description"]}\nValue: {hex(sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"])}\nIntroduced in: macOS {sip_data.system_integrity_protection.csr_values_extended[sip_bit]["introduced_friendly"]}')
if self.sip_value & sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"] == sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"]:
@@ -951,7 +951,7 @@ class SettingsFrame(wx.Frame):
horizontal_spacer += 20
if index == entries_per_row:
horizontal_spacer = 20
horizontal_spacer = 15
vertical_spacer += 250
index += 1
@@ -967,11 +967,11 @@ class SettingsFrame(wx.Frame):
# Label: Custom Serial Number
custom_serial_number_label = wx.StaticText(panel, label="Custom Serial Number", pos=(title.GetPosition()[0] - 150, title.GetPosition()[1] + 30))
custom_serial_number_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
custom_serial_number_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
# Textbox: Custom Serial Number
custom_serial_number_textbox = wx.TextCtrl(panel, pos=(custom_serial_number_label.GetPosition()[0] - 27, custom_serial_number_label.GetPosition()[1] + 20), size=(200, 25))
custom_serial_number_textbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
custom_serial_number_textbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
custom_serial_number_textbox.SetToolTip("Enter a custom serial number here. This will be used for the SMBIOS and iMessage.\n\nNote: This will not be used if the \"Use Custom Serial Number\" checkbox is not checked.")
custom_serial_number_textbox.Bind(wx.EVT_TEXT, self.on_custom_serial_number_textbox)
custom_serial_number_textbox.SetValue(self.constants.custom_serial_number)
@@ -979,11 +979,11 @@ class SettingsFrame(wx.Frame):
# Label: Custom Board Serial Number
custom_board_serial_number_label = wx.StaticText(panel, label="Custom Board Serial Number", pos=(title.GetPosition()[0] + 120, custom_serial_number_label.GetPosition()[1]))
custom_board_serial_number_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
custom_board_serial_number_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD))
# Textbox: Custom Board Serial Number
custom_board_serial_number_textbox = wx.TextCtrl(panel, pos=(custom_board_serial_number_label.GetPosition()[0] - 5, custom_serial_number_textbox.GetPosition()[1]), size=(200, 25))
custom_board_serial_number_textbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
custom_board_serial_number_textbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
custom_board_serial_number_textbox.SetToolTip("Enter a custom board serial number here. This will be used for the SMBIOS and iMessage.\n\nNote: This will not be used if the \"Use Custom Board Serial Number\" checkbox is not checked.")
custom_board_serial_number_textbox.Bind(wx.EVT_TEXT, self.on_custom_board_serial_number_textbox)
custom_board_serial_number_textbox.SetValue(self.constants.custom_board_serial_number)
@@ -991,7 +991,7 @@ class SettingsFrame(wx.Frame):
# Button: Generate Serial Number (below)
generate_serial_number_button = wx.Button(panel, label=f"Generate S/N: {self.constants.custom_model or self.constants.computer.real_model}", pos=(title.GetPosition()[0] - 30, custom_board_serial_number_label.GetPosition()[1] + 60), size=(200, 25))
generate_serial_number_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
generate_serial_number_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
generate_serial_number_button.Bind(wx.EVT_BUTTON, self.on_generate_serial_number)
@@ -1024,7 +1024,7 @@ Hardware Information:
"""
# TextCtrl: properties
self.app_stats = wx.TextCtrl(panel, value=lines, pos=(-1, title.GetPosition()[1] + 30), size=(600, 240), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
self.app_stats.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.app_stats.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
def on_checkbox(self, event: wx.Event, warning_pop: str = "", override_function: bool = False) -> None: