From ce0928ba38782dc331e294729e8f4362f3e456c6 Mon Sep 17 00:00:00 2001 From: Jazzzny Date: Fri, 29 Sep 2023 17:51:51 -0400 Subject: [PATCH] Changes --- resources/utilities.py | 4 ++-- resources/wx_gui/gui_download.py | 8 ++++++-- resources/wx_gui/gui_main_menu.py | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/resources/utilities.py b/resources/utilities.py index 9c866e948..803af348b 100644 --- a/resources/utilities.py +++ b/resources/utilities.py @@ -60,8 +60,8 @@ def seconds_to_readable_time(seconds) -> str: seconds = int(seconds) time = "" - if seconds == 0: - return "0m " + if seconds < 60: + return "Less than a minute " if seconds < 0: return "Indeterminate time " diff --git a/resources/wx_gui/gui_download.py b/resources/wx_gui/gui_download.py index e1d77d42f..8e456ab18 100644 --- a/resources/wx_gui/gui_download.py +++ b/resources/wx_gui/gui_download.py @@ -50,7 +50,7 @@ class DownloadFrame(wx.Frame): title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) - progress_bar = wx.Gauge(frame, range=100, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(300, 20)) + progress_bar = wx.Gauge(frame, range=100, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(300, 20), style=wx.GA_SMOOTH|wx.GA_PROGRESS) progress_bar.Centre(wx.HORIZONTAL) label_amount = wx.StaticText(frame, label="Preparing download", pos=(-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1])) @@ -68,7 +68,11 @@ class DownloadFrame(wx.Frame): self.download_obj.download() while self.download_obj.is_active(): - percentage: int = self.download_obj.get_percent() + percentage: int = round(self.download_obj.get_percent()) + if percentage == 0: + percentage = 1 + + logging.info(f"Download progress: {percentage}%") if percentage == -1: amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded ({utilities.human_fmt(self.download_obj.get_speed())}/s)" diff --git a/resources/wx_gui/gui_main_menu.py b/resources/wx_gui/gui_main_menu.py index fc023f00d..bafdf1344 100644 --- a/resources/wx_gui/gui_main_menu.py +++ b/resources/wx_gui/gui_main_menu.py @@ -402,6 +402,7 @@ class MainFrame(wx.Frame): sizer.Add(buttonsizer, 0, wx.ALIGN_RIGHT | wx.ALL, 20) panel.SetSizer(sizer) frame.Show() + frame.Centre() def _onWebviewNav(self, event): url = event.GetURL()