mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 06:44:00 -06:00
ui: show 2 decimal places in progress bars
This commit is contained in:
@@ -29,8 +29,8 @@ class CustomProgressBar(urwid.Widget):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def get_text(self) -> str:
|
def get_text(self) -> str:
|
||||||
percent = min(100, max(0, int(self.position * 100 / self.max_)))
|
percent = min(100.0, max(0.0, self.position * 100.0 / self.max_))
|
||||||
return str(percent) + " %"
|
return f"{percent:.02f} %"
|
||||||
|
|
||||||
def render(self, size: T.Tuple[int, int], focus: bool = False) -> T.Any:
|
def render(self, size: T.Tuple[int, int], focus: bool = False) -> T.Any:
|
||||||
(maxcol,) = size
|
(maxcol,) = size
|
||||||
|
|||||||
Reference in New Issue
Block a user