From 8e7d202c32a378d2a73bf359fd6b5d2977cd91ac Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 3 Jun 2023 18:58:29 -0700 Subject: [PATCH] Add reset_title_pane() to tui --- scripts/wk/ui/tui.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/wk/ui/tui.py b/scripts/wk/ui/tui.py index 2c59cf0d..cb07cd85 100644 --- a/scripts/wk/ui/tui.py +++ b/scripts/wk/ui/tui.py @@ -222,6 +222,19 @@ class TUI(): self.layout['Workers']['Panes'].clear() tmux.kill_pane(*panes) + def reset_title_pane( + self, + line1: str = 'Title Text', + line2: str = '', + colors: list[str] | None = ['BLUE', ''], + ) -> None: + """Remove all extra title panes, reset main title pane, and update layout.""" + panes = self.layout['Title']['Panes'].copy() + if len(panes) > 1: + tmux.kill_pane(*panes[1:]) + self.layout['Title']['Panes'] = panes[:1] + self.set_title(line1, line2, colors) + def set_current_pane_height(self, height: int) -> None: """Set current pane height and update layout.""" self.layout['Current']['height'] = height