From 15bf5673e36bc5a2958dee1aa78a34851a6c4cbc Mon Sep 17 00:00:00 2001 From: oop7 <110548351+oop7@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:27:05 +0200 Subject: [PATCH] Refactor table column sizing for mixed stretch modes Updated the format table column configuration to use a 'stretch' flag for each column, allowing some columns to stretch while others remain fixed. This improves layout flexibility and ensures important columns have consistent sizing. --- src/gui/ytsage_gui_format_table.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/gui/ytsage_gui_format_table.py b/src/gui/ytsage_gui_format_table.py index 441da3c..3e4a38e 100644 --- a/src/gui/ytsage_gui_format_table.py +++ b/src/gui/ytsage_gui_format_table.py @@ -47,25 +47,28 @@ class FormatTableMixin: else: # Normal mode: 9 columns configs = [ - {"min_width": 70, "padding": 40}, # Select - needs space for checkbox - {"min_width": 100, "padding": 30}, # Quality - {"min_width": 85, "padding": 30}, # Extension - {"min_width": 100, "padding": 30}, # Resolution - {"min_width": 90, "padding": 30}, # File Size - {"min_width": 100, "padding": 30}, # Codec - {"min_width": 100, "padding": 30}, # Audio - {"min_width": 60, "padding": 30}, # FPS - {"min_width": 60, "padding": 30}, # HDR + {"min_width": 70, "padding": 40, "stretch": False}, # Select - fixed + {"min_width": 100, "padding": 30, "stretch": True}, # Quality - stretch + {"min_width": 85, "padding": 30, "stretch": False}, # Extension - fixed + {"min_width": 100, "padding": 30, "stretch": True}, # Resolution - stretch + {"min_width": 90, "padding": 30, "stretch": True}, # File Size - stretch + {"min_width": 100, "padding": 30, "stretch": True}, # Codec - stretch + {"min_width": 100, "padding": 30, "stretch": True}, # Audio - stretch + {"min_width": 60, "padding": 30, "stretch": False}, # FPS - fixed + {"min_width": 60, "padding": 30, "stretch": False}, # HDR - fixed ] + # Apply column widths with mixed fixed and stretch modes for col_index, (label, config) in enumerate(zip(header_labels, configs)): calculated_width = self._calculate_column_width(label, config["min_width"], config["padding"]) - if col_index < 8: # All columns except the last one are fixed + if config["stretch"]: + # Stretchable columns for flexible content + self.format_table.horizontalHeader().setSectionResizeMode(col_index, QHeaderView.ResizeMode.Stretch) + else: + # Fixed columns for consistent sizing self.format_table.horizontalHeader().setSectionResizeMode(col_index, QHeaderView.ResizeMode.Fixed) self.format_table.setColumnWidth(col_index, calculated_width) - else: # HDR column stretches to fill remaining space - self.format_table.horizontalHeader().setSectionResizeMode(col_index, QHeaderView.ResizeMode.Stretch) def setup_format_table(self) -> QTableWidget: self = cast("YTSageApp", self) # for autocompletion and type inference.