mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-14 12:48:18 +10:00
GUI: Add branch selection
This commit is contained in:
@@ -15,7 +15,8 @@ from resources import (
|
||||
constants,
|
||||
global_settings,
|
||||
defaults,
|
||||
generate_smbios
|
||||
generate_smbios,
|
||||
network_handler
|
||||
)
|
||||
from data import (
|
||||
model_array,
|
||||
@@ -1180,15 +1181,35 @@ Hardware Information:
|
||||
|
||||
|
||||
def on_nightly(self, event: wx.Event) -> None:
|
||||
# Ask prompt for which branch
|
||||
branches = ["main"]
|
||||
result = network_handler.NetworkUtilities().get("https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/branches")
|
||||
if result is not None:
|
||||
result = result.json()
|
||||
for branch in result:
|
||||
if branch["name"] == "gh-pages":
|
||||
continue
|
||||
if branch["name"] not in branches:
|
||||
branches.append(branch["name"])
|
||||
|
||||
with wx.SingleChoiceDialog(self.parent, "Which branch would you like to download?", "Branch Selection", branches) as dialog:
|
||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||
return
|
||||
|
||||
branch = dialog.GetStringSelection()
|
||||
else:
|
||||
branch = "main"
|
||||
|
||||
gui_update.UpdateFrame(
|
||||
parent=self.parent,
|
||||
title=self.title,
|
||||
global_constants=self.constants,
|
||||
screen_location=self.parent.GetPosition(),
|
||||
url="https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/main/OpenCore-Patcher.app%20%28GUI%29.zip",
|
||||
url=f"https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython/{branch}/OpenCore-Patcher.app%20%28GUI%29.zip",
|
||||
version_label="(Nightly)"
|
||||
)
|
||||
|
||||
|
||||
def on_export_constants(self, event: wx.Event) -> None:
|
||||
# Throw pop up to get save location
|
||||
with wx.FileDialog(self.parent, "Save Constants File", wildcard="JSON files (*.txt)|*.txt", style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:
|
||||
|
||||
Reference in New Issue
Block a user