From 17a40862fd99d4f6916d372aaf3fa6b4db4e3616 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 18 Jun 2021 09:37:55 -0400 Subject: [PATCH] Fix old msg clearing var name --- piker/ui/_window.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/piker/ui/_window.py b/piker/ui/_window.py index e45b58e4..3668b6d5 100644 --- a/piker/ui/_window.py +++ b/piker/ui/_window.py @@ -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: