Fix old msg clearing var name

asyncify_input_modes
Tyler Goodlet 2021-06-18 09:37:55 -04:00
parent eeeeb29f71
commit 37180a4e4e
1 changed files with 9 additions and 7 deletions

View File

@ -43,7 +43,6 @@ class MultiStatus:
def __init__(self, bar, statuses) -> None:
self.bar = bar
self.statuses = statuses
# self._clear_last: Optional[Callable[..., None]] = None
self._to_clear: set = set()
self._status_groups: dict[str, (set, Callable)] = {}
@ -60,9 +59,9 @@ class MultiStatus:
when called will remove the status ``msg``.
'''
for msg in self._to_clear:
for old_msg in self._to_clear:
try:
self.statuses.remove(msg)
self.statuses.remove(old_msg)
except ValueError:
pass
@ -71,16 +70,16 @@ class MultiStatus:
def remove_msg() -> None:
try:
self.statuses.remove(msg)
self.render()
except ValueError:
pass
self.render()
if final_msg is not None:
self.statuses.append(final_msg)
self.render()
self._to_clear.add(final_msg)
ret = remove_msg
# create a "status group" such that new `.open_status()`
@ -128,14 +127,17 @@ class MultiStatus:
self._status_groups[group_key][0].add(msg)
ret = pop_from_group_and_maybe_clear_group
self.render()
if clear_on_next:
self._to_clear.add(msg)
self.render()
return ret
def render(self) -> None:
'''Display all open statuses to bar.
'''
if self.statuses:
self.bar.showMessage(f'{" ".join(self.statuses)}')
else: