From 039656610b949736b9255ce022e62107eb9b3084 Mon Sep 17 00:00:00 2001 From: Oliver 'kfsone' Smith Date: Tue, 23 Apr 2024 18:17:29 -0700 Subject: [PATCH] fix: presentation was a bit wonky with doubled progress bars --- tradedangerous/plugins/spansh_plug.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tradedangerous/plugins/spansh_plug.py b/tradedangerous/plugins/spansh_plug.py index 56851cbb..a908cc82 100644 --- a/tradedangerous/plugins/spansh_plug.py +++ b/tradedangerous/plugins/spansh_plug.py @@ -259,6 +259,14 @@ def run(self) -> bool: theme = self.tdenv.theme BOLD, CLOSE, DIM, ITALIC = theme.bold, theme.CLOSE, theme.dim, theme.italic # pylint: disable=invalid-name + + if not self.file: + url = self.url or SOURCE_URL + self.print(f'Downloading prices from remote URL: {url}') + self.file = Path(self.tdenv.tmpDir, "galaxy_stations.json") + transfers.download(self.tdenv, url, self.file) + self.print(f'Download complete, saved to local file: "{self.file}"') + sys_desc = f"Importing {ITALIC}spansh{CLOSE} data" with Timing() as timing, Progresser(self.tdenv, sys_desc, total=len(self.known_systems)) as progress: @@ -377,13 +385,6 @@ def run(self) -> bool: return False def data_stream(self): - if not self.file: - url = self.url or SOURCE_URL - self.print(f'Downloading prices from remote URL: {url}') - self.file = Path(self.tdenv.tmpDir, "galaxy_stations.json") - transfers.download(self.tdenv, url, self.file) - self.print(f'Download complete, saved to local file: "{self.file}"') - if self.file == '-': self.print('Reading prices from stdin') stream = sys.stdin