mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-24 20:10:14 +10:00
GUI: Add pulse for unknown total size
This commit is contained in:
@@ -64,10 +64,15 @@ class DownloadFrame(wx.Frame):
|
|||||||
|
|
||||||
self.download_obj.download()
|
self.download_obj.download()
|
||||||
while self.download_obj.is_active():
|
while self.download_obj.is_active():
|
||||||
if self.download_obj.get_percent() == -1:
|
percentage: int = self.download_obj.get_percent()
|
||||||
|
|
||||||
|
if percentage == -1:
|
||||||
amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded"
|
amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded"
|
||||||
|
progress_bar.Pulse()
|
||||||
else:
|
else:
|
||||||
amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded of {utilities.human_fmt(self.download_obj.total_file_size)} ({self.download_obj.get_percent():.2f}%)"
|
amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded of {utilities.human_fmt(self.download_obj.total_file_size)} ({percentage:.2f}%)"
|
||||||
|
progress_bar.SetValue(int(percentage))
|
||||||
|
|
||||||
label_amount.SetLabel(amount_str)
|
label_amount.SetLabel(amount_str)
|
||||||
label_amount.Centre(wx.HORIZONTAL)
|
label_amount.Centre(wx.HORIZONTAL)
|
||||||
|
|
||||||
@@ -79,7 +84,6 @@ class DownloadFrame(wx.Frame):
|
|||||||
f"Estimated time remaining: {utilities.seconds_to_readable_time(self.download_obj.get_time_remaining())}"
|
f"Estimated time remaining: {utilities.seconds_to_readable_time(self.download_obj.get_time_remaining())}"
|
||||||
)
|
)
|
||||||
|
|
||||||
progress_bar.SetValue(int(self.download_obj.get_percent()))
|
|
||||||
wx.Yield()
|
wx.Yield()
|
||||||
|
|
||||||
if self.download_obj.download_complete is False and self.user_cancelled is False:
|
if self.download_obj.download_complete is False and self.user_cancelled is False:
|
||||||
|
|||||||
@@ -89,8 +89,16 @@ class UpdateFrame(wx.Frame):
|
|||||||
self.frame.Show()
|
self.frame.Show()
|
||||||
wx.Yield()
|
wx.Yield()
|
||||||
|
|
||||||
|
download_obj = None
|
||||||
|
def _fetch_update() -> None:
|
||||||
|
nonlocal download_obj
|
||||||
download_obj = network_handler.DownloadObject(url, self.constants.payload_path / "OpenCore-Patcher-GUI.app.zip")
|
download_obj = network_handler.DownloadObject(url, self.constants.payload_path / "OpenCore-Patcher-GUI.app.zip")
|
||||||
|
|
||||||
|
thread = threading.Thread(target=_fetch_update)
|
||||||
|
thread.start()
|
||||||
|
while thread.is_alive():
|
||||||
|
wx.Yield()
|
||||||
|
|
||||||
gui_download.DownloadFrame(
|
gui_download.DownloadFrame(
|
||||||
self.frame,
|
self.frame,
|
||||||
title=self.title,
|
title=self.title,
|
||||||
|
|||||||
Reference in New Issue
Block a user