Improve history dialog to show full list of added and missing songs with word wrap and auto row sizing
This commit is contained in:
1 parent
f958ea0983
commit
3d18efb88f
1 file changed
+6
-6
+6
-6
@@ -645,6 +645,8 @@ class MainWindow(QMainWindow):
|
|||||||
table.setColumnCount(4)
|
table.setColumnCount(4)
|
||||||
table.setHorizontalHeaderLabels(["Date", "Added Songs", "Missing Songs", "Details"])
|
table.setHorizontalHeaderLabels(["Date", "Added Songs", "Missing Songs", "Details"])
|
||||||
table.horizontalHeader().setStretchLastSection(True)
|
table.horizontalHeader().setStretchLastSection(True)
|
||||||
|
table.setWordWrap(True)
|
||||||
|
table.resizeRowsToContents()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn = sqlite3.connect('playlist_history.db')
|
conn = sqlite3.connect('playlist_history.db')
|
||||||
@@ -665,18 +667,14 @@ class MainWindow(QMainWindow):
|
|||||||
# Added songs
|
# Added songs
|
||||||
try:
|
try:
|
||||||
added_songs = json.loads(added_songs_json)
|
added_songs = json.loads(added_songs_json)
|
||||||
added_text = f"{added_count} songs\n" + "\n".join(added_songs[:3]) # Show first 3
|
added_text = f"{added_count} songs:\n" + "\n".join(added_songs)
|
||||||
if len(added_songs) > 3:
|
|
||||||
added_text += f"\n... and {len(added_songs)-3} more"
|
|
||||||
except:
|
except:
|
||||||
added_text = f"{added_count} songs"
|
added_text = f"{added_count} songs"
|
||||||
|
|
||||||
# Missing songs
|
# Missing songs
|
||||||
try:
|
try:
|
||||||
missing_songs = json.loads(missing_songs_json)
|
missing_songs = json.loads(missing_songs_json)
|
||||||
missing_text = f"{missing_count} songs\n" + "\n".join([f"{s['artist']} - {s['title']}" for s in missing_songs[:3]])
|
missing_text = f"{missing_count} songs:\n" + "\n".join([f"{s['artist']} - {s['title']}" for s in missing_songs])
|
||||||
if len(missing_songs) > 3:
|
|
||||||
missing_text += f"\n... and {len(missing_songs)-3} more"
|
|
||||||
except:
|
except:
|
||||||
missing_text = f"{missing_count} songs"
|
missing_text = f"{missing_count} songs"
|
||||||
|
|
||||||
@@ -685,6 +683,8 @@ class MainWindow(QMainWindow):
|
|||||||
table.setItem(row_idx, 2, QTableWidgetItem(missing_text))
|
table.setItem(row_idx, 2, QTableWidgetItem(missing_text))
|
||||||
table.setItem(row_idx, 3, QTableWidgetItem(f"Added: {added_count}, Missing: {missing_count}"))
|
table.setItem(row_idx, 3, QTableWidgetItem(f"Added: {added_count}, Missing: {missing_count}"))
|
||||||
|
|
||||||
|
table.resizeRowsToContents()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
table.setRowCount(1)
|
table.setRowCount(1)
|
||||||
table.setItem(0, 0, QTableWidgetItem("Error loading history"))
|
table.setItem(0, 0, QTableWidgetItem("Error loading history"))
|
||||||
|
|||||||
Reference in new issue
Block a user