This commit is contained in:
Jazzzny
2023-10-04 18:01:05 -04:00
parent 526594a90d
commit 4429b5cb4b
2 changed files with 13 additions and 14 deletions
+6 -6
View File
@@ -60,9 +60,9 @@ class AutomaticSysPatch:
ID_GITHUB = wx.NewId() ID_GITHUB = wx.NewId()
ID_UPDATE = wx.NewId() ID_UPDATE = wx.NewId()
url = f"https://raw.githubusercontent.com/dortania/OpenCore-Legacy-Patcher/{version}/CHANGELOG.md" url = "https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest"
response = requests.get(url) response = requests.get(url).json()
changelog = response.text.split(f"## {self.constants.patcher_version}\n")[0] changelog = response["body"].split("## Asset Information")[0]
html_markdown = markdown2.markdown(changelog) html_markdown = markdown2.markdown(changelog)
html_css = """ html_css = """
@@ -90,8 +90,8 @@ class AutomaticSysPatch:
} }
</style> </style>
""" """
frame = wx.Dialog(None, -1, title="", size=(600, 400)) frame = wx.Dialog(None, -1, title="", size=(600, 500))
frame.SetMinSize((600, 400)) frame.SetMinSize((600, 500))
frame.SetWindowStyle(wx.STAY_ON_TOP) frame.SetWindowStyle(wx.STAY_ON_TOP)
panel = wx.Panel(frame) panel = wx.Panel(frame)
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
@@ -101,7 +101,7 @@ class AutomaticSysPatch:
self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN) self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN)
html_code = html_css+html_markdown.replace("<a href=", "<a target='_blank' href=").replace("<h1>OpenCore Legacy Patcher changelog</h1>", "") html_code = html_css+html_markdown.replace("<a href=", "<a target='_blank' href=")
self.web_view.SetPage(html_code, "") self.web_view.SetPage(html_code, "")
self.web_view.Bind(wx.html2.EVT_WEBVIEW_NEWWINDOW, self._onWebviewNav) self.web_view.Bind(wx.html2.EVT_WEBVIEW_NEWWINDOW, self._onWebviewNav)
self.web_view.EnableContextMenu(False) self.web_view.EnableContextMenu(False)
+7 -8
View File
@@ -343,9 +343,9 @@ class MainFrame(wx.Frame):
ID_GITHUB = wx.NewId() ID_GITHUB = wx.NewId()
ID_UPDATE = wx.NewId() ID_UPDATE = wx.NewId()
url = f"https://raw.githubusercontent.com/dortania/OpenCore-Legacy-Patcher/{oclp_version}/CHANGELOG.md" url = "https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest"
response = requests.get(url) response = requests.get(url).json()
changelog = response.text.split(f"## {self.constants.patcher_version}\n")[0] changelog = response["body"].split("## Asset Information")[0]
html_markdown = markdown2.markdown(changelog) html_markdown = markdown2.markdown(changelog)
html_css = """ html_css = """
@@ -359,7 +359,6 @@ class MainFrame(wx.Frame):
} }
h2 { h2 {
line-height: 0.5; line-height: 0.5;
padding-left: 10px;
} }
a { a {
color: -apple-system-control-accent; color: -apple-system-control-accent;
@@ -373,8 +372,8 @@ class MainFrame(wx.Frame):
} }
</style> </style>
""" """
frame = wx.Dialog(None, -1, title="", size=(600, 400)) frame = wx.Dialog(None, -1, title="", size=(600, 500))
frame.SetMinSize((600, 400)) frame.SetMinSize((600, 500))
frame.SetWindowStyle(wx.STAY_ON_TOP) frame.SetWindowStyle(wx.STAY_ON_TOP)
panel = wx.Panel(frame) panel = wx.Panel(frame)
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
@@ -384,11 +383,11 @@ class MainFrame(wx.Frame):
self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) self.title_text.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) self.description.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN) self.web_view = wx.html2.WebView.New(panel, style=wx.BORDER_SUNKEN)
html_code = html_css+html_markdown.replace("<a href=", "<a target='_blank' href=").replace("<h1>OpenCore Legacy Patcher changelog</h1>", "") html_code = html_css+html_markdown.replace("<a href=", "<a target='_blank' href=")
self.web_view.SetPage(html_code, "") self.web_view.SetPage(html_code, "")
self.web_view.Bind(wx.html2.EVT_WEBVIEW_NEWWINDOW, self._onWebviewNav) self.web_view.Bind(wx.html2.EVT_WEBVIEW_NEWWINDOW, self._onWebviewNav)
self.web_view.EnableContextMenu(False) self.web_view.EnableContextMenu(False)
self.close_button = wx.Button(panel, label="Ignore") self.close_button = wx.Button(panel, label="Dismiss")
self.close_button.Bind(wx.EVT_BUTTON, lambda event: frame.EndModal(wx.ID_CANCEL)) self.close_button.Bind(wx.EVT_BUTTON, lambda event: frame.EndModal(wx.ID_CANCEL))
self.view_button = wx.Button(panel, ID_GITHUB, label="View on GitHub") self.view_button = wx.Button(panel, ID_GITHUB, label="View on GitHub")
self.view_button.Bind(wx.EVT_BUTTON, lambda event: frame.EndModal(ID_GITHUB)) self.view_button.Bind(wx.EVT_BUTTON, lambda event: frame.EndModal(ID_GITHUB))