@@ -123,14 +123,21 @@ def wait_with_progress(console: Console, wait: int) -> None:
123123# ----- Progress + Layout helpers ----- #
124124
125125
126- def make_layout (progress : Progress , table_renderable ) -> Layout :
126+ def make_layout (progress : Progress , tables : Group ) -> Layout :
127127 """
128- Create the main UI layout with the progress bar above the table.
128+ Create the main UI layout with the progress bar above the table,
129+ matching to the table width dynamically.
129130 """
131+ # Compute max width among all panels in the Group
132+ table_width = max (
133+ getattr (panel .renderable , "width" , 0 ) + 2 # +2 for panel padding/borders
134+ for panel in tables .renderables
135+ )
136+
130137 layout = Layout ()
131138 layout .split_column (
132- Layout (Panel (progress , title = "Next HTCondor query" , padding = (0 , 1 )), size = 3 ),
133- Layout (table_renderable , ratio = 1 ),
139+ Layout (Panel (progress , title = "Next HTCondor query" , padding = (0 , 1 ), width = table_width ) ),
140+ Layout (tables , ratio = 1 ),
134141 )
135142 return layout
136143
@@ -173,14 +180,14 @@ def main(
173180 try :
174181 # Once per cycle, query HTCondor the process its output
175182 # and generate the table to be displayed
176- table : Group = generate_renderable ()
183+ tables : Group = generate_renderable ()
177184
178185 # Reset the progress bar (we just queried HTCondor)
179186 progress .reset (task_id )
180187 progress .update (task_id , total = wait , completed = 0 )
181188
182189 # We start rendering our layout with progress + table
183- layout : Layout = make_layout (progress , table )
190+ layout : Layout = make_layout (progress , tables )
184191 live .update (layout )
185192
186193 # Now we need to update the progress bar until we have
0 commit comments