From 70ab6eab4808b3ab8bdb51a6f818ff100c5ea4d1 Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 8 Nov 2018 22:11:24 +0100 Subject: [PATCH] ui: show 2 decimal places in progress bars --- pqcli/ui/custom_progress_bar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pqcli/ui/custom_progress_bar.py b/pqcli/ui/custom_progress_bar.py index 416db0b..4243ad7 100644 --- a/pqcli/ui/custom_progress_bar.py +++ b/pqcli/ui/custom_progress_bar.py @@ -29,8 +29,8 @@ class CustomProgressBar(urwid.Widget): return 1 def get_text(self) -> str: - percent = min(100, max(0, int(self.position * 100 / self.max_))) - return str(percent) + " %" + percent = min(100.0, max(0.0, self.position * 100.0 / self.max_)) + return f"{percent:.02f} %" def render(self, size: T.Tuple[int, int], focus: bool = False) -> T.Any: (maxcol,) = size