ui: improve predicted times near zero values

This commit is contained in:
rr-
2018-11-10 17:24:42 +01:00
parent 16ec0cfa5d
commit e7d5947299
2 changed files with 19 additions and 11 deletions
+7
View File
@@ -55,6 +55,13 @@ class CustomProgressBar(urwid.Widget):
self.max_ = value
self._invalidate()
def reset(self, cur: float, max_: T.Union[int, float]) -> None:
if self.last_tick is None or cur == 0 or max_ != self.max_:
self.last_tick = (datetime.datetime.now(), cur)
self.position = cur
self.max_ = max_
self._invalidate()
def rows(self, size: T.Tuple[int, int], focus: bool = False) -> int:
return 1