diff --git a/scripts/wk/ui/tmux.py b/scripts/wk/ui/tmux.py index 726f841f..94c4792a 100644 --- a/scripts/wk/ui/tmux.py +++ b/scripts/wk/ui/tmux.py @@ -73,7 +73,7 @@ def fix_layout( avail_vertical -= layout[group].get('height', 0) + 1 num_workers = len(layout['Workers']['Panes']) avail_vertical -= num_workers * (layout['Workers'].get('height', 0) + 1) - avail_horizontal -= layout['Started']['width'] + 1 + avail_horizontal -= layout['Progress']['width'] + 1 # Fix heights for group, data in layout.items(): @@ -89,10 +89,12 @@ def fix_layout( ) # Fix widths - for group in ('Started', 'Progress'): - resize_kwargs.append( - {'pane_id': layout[group]['Panes'][0], 'width': layout[group]['width']} - ) + resize_kwargs.append( + {'pane_id': layout['Progress']['Panes'][0], 'width': layout['Progress']['width']} + ) + resize_kwargs.append( + {'pane_id': layout['Started']['Panes'][0], 'height': layout['Started']['height']} + ) for group, data in layout.items(): num_panes = len(data['Panes']) if num_panes < 2 or group not in ('Title', 'Info'): diff --git a/scripts/wk/ui/tui.py b/scripts/wk/ui/tui.py index 23ab6470..a32dde76 100644 --- a/scripts/wk/ui/tui.py +++ b/scripts/wk/ui/tui.py @@ -22,7 +22,7 @@ TMUX_LAYOUT = { # NOTE: This needs to be in order from top to bottom 'Info': {'Panes': []}, 'Current': {'Panes': [environ.get('TMUX_PANE', None)]}, 'Workers': {'Panes': []}, - 'Started': {'Panes': [], 'width': TMUX_SIDE_WIDTH}, + 'Started': {'Panes': [], 'height': TMUX_TITLE_HEIGHT}, 'Progress': {'Panes': [], 'width': TMUX_SIDE_WIDTH}, } @@ -180,6 +180,25 @@ class TUI(): self.layout.clear() self.layout.update(deepcopy(TMUX_LAYOUT)) + # Progress + self.layout['Progress']['Panes'].append(tmux.split_window( + lines=TMUX_SIDE_WIDTH, + text=' ', + )) + + # Started + self.layout['Started']['Panes'].append(tmux.split_window( + behind=True, + lines=2, + target_id=self.layout['Progress']['Panes'][0], + text=ansi.color_string( + ['Started', time.strftime("%Y-%m-%d %H:%M %Z")], + ['BLUE', None], + sep='\n', + ), + vertical=True, + )) + # Title self.layout['Title']['Panes'].append(tmux.split_window( behind=True, @@ -192,23 +211,6 @@ class TUI(): ), )) - # Started - self.layout['Started']['Panes'].append(tmux.split_window( - lines=TMUX_SIDE_WIDTH, - target_id=self.layout['Title']['Panes'][0], - text=ansi.color_string( - ['Started', time.strftime("%Y-%m-%d %H:%M %Z")], - ['BLUE', None], - sep='\n', - ), - )) - - # Progress - self.layout['Progress']['Panes'].append(tmux.split_window( - lines=TMUX_SIDE_WIDTH, - text=' ', - )) - def remove_all_info_panes(self) -> None: """Remove all info panes and update layout.""" self.layout['Info'].pop('height', None)