summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Cantara <1975723+joshuacant@users.noreply.github.com>2025-09-01 15:34:29 -0400
committerJoshua Cantara <1975723+joshuacant@users.noreply.github.com>2025-09-01 15:34:29 -0400
commit3462f5a26ac034ece862ba41012dcf081159d8d1 (patch)
treeceb91a0db29e0f436996fbf835ed318f8ad4323d
parent4c0d78b5edc120f3ff5a651eb1e4700bad9c611c (diff)
downloadtidal-dl-ng-3462f5a26ac034ece862ba41012dcf081159d8d1.tar.gz
set column widths dynamically based on window width
-rw-r--r--tidal_dl_ng/gui.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index 2747f83..aebb135 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -360,9 +360,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
## Styling
tree.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
tree.setColumnHidden(1, True)
- tree.setColumnWidth(2, 150)
- tree.setColumnWidth(3, 150)
- tree.setColumnWidth(4, 150)
+ normal_width = max(150, (self.width() * 0.13)) # 12% for normal fields
+ narrow_width = max(90, (self.width() * 0.06)) # 6% for shorter fields
+ skinny_width = max(60, (self.width() * 0.03)) # 3% for very short fields
+ tree.setColumnWidth(2, normal_width) # artist
+ tree.setColumnWidth(3, normal_width) # title
+ tree.setColumnWidth(4, normal_width) # album
+ tree.setColumnWidth(5, skinny_width) # duration
+ tree.setColumnWidth(6, narrow_width) # quality
+ tree.setColumnWidth(7, narrow_width) # date
header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
# Connect the contextmenu
tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)