1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 10:16:39 +00:00

host: fix speed calculation issues

This commit is contained in:
Pablo Curiel 2024-10-08 00:57:01 +02:00
parent 14acd00559
commit f7d6eaf73f

View file

@ -471,10 +471,6 @@ class ProgressBarWindow:
self.total_div = (float(self.total) / self.divisor) self.total_div = (float(self.total) / self.divisor)
# Replace our custom rate variable with tqdm's rate_fmt if our unit is set to MiB.
if self.unit == 'MiB':
self.bar_format = self.bar_format.replace('__custom_rate_fmt__', '{rate_fmt}')
if self.tk_pbar: if self.tk_pbar:
self.tk_pbar.configure(maximum=self.total_div, mode='determinate') self.tk_pbar.configure(maximum=self.total_div, mode='determinate')
self.start_time = time.time() self.start_time = time.time()
@ -530,7 +526,7 @@ class ProgressBarWindow:
def _format_speed(self, cur_time: float, cur_n: int) -> str: def _format_speed(self, cur_time: float, cur_n: int) -> str:
# Short-circuit: return immediately if our unit is set to MiB. We'll let tqdm do its thing. # Short-circuit: return immediately if our unit is set to MiB. We'll let tqdm do its thing.
if self.unit == 'MiB': if self.unit == 'MiB':
return self.bar_format return self.bar_format.replace('__custom_rate_fmt__', '{rate_fmt}')
# I absolutely hate to roll out my own speed calculation for the UI, but tqdm offers no way to use different units for the progress/total/rate values. # I absolutely hate to roll out my own speed calculation for the UI, but tqdm offers no way to use different units for the progress/total/rate values.
# Please forgive me. # Please forgive me.