Add debug message and better error handling for buy list dialog

This commit is contained in:
nmemmert committed 2025-11-17 11:39:52 -05:00
1 parent 3f377e165d
commit 2da02dc7df
1 file changed
+7
+7
View File
@@ -454,13 +454,18 @@ class MainWindow(QMainWindow):
def show_buy_list(self):
"""Show the Amazon buy list dialog with interactive features"""
QMessageBox.information(self, "Debug", "Show buy list called")
try:
with open('amazon_buy_list.txt', 'r') as f:
content = f.read()
except FileNotFoundError:
QMessageBox.information(self, "No Buy List", "No buy list available. Run an update to generate the list.")
return
except Exception as e:
QMessageBox.critical(self, "Error", f"Failed to read buy list file: {e}")
return
try:
# Parse content to get songs
lines = content.split('\n')
songs = []
@@ -522,6 +527,8 @@ class MainWindow(QMainWindow):
dialog.raise_()
dialog.activateWindow()
dialog.exec()
except Exception as e:
QMessageBox.critical(self, "Error", f"Failed to show buy list dialog: {e}")
def populate_buy_list(self, songs):
"""Populate the buy list widget"""