Fix buy list dialog to show properly with modal exec and proper HTML

This commit is contained in:
nmemmert committed 2025-11-17 11:24:06 -05:00
1 parent 589cbca2f6
commit f12b50f9d0
1 file changed
+4 -3
+4 -3
View File
@@ -439,7 +439,6 @@ class MainWindow(QMainWindow):
def show_buy_list(self): def show_buy_list(self):
"""Show the Amazon buy list dialog""" """Show the Amazon buy list dialog"""
QMessageBox.information(self, "Debug", "Buy list button clicked!")
try: try:
with open('amazon_buy_list.txt', 'r') as f: with open('amazon_buy_list.txt', 'r') as f:
content = f.read() content = f.read()
@@ -451,10 +450,12 @@ class MainWindow(QMainWindow):
# Make URLs clickable # Make URLs clickable
import re import re
html_content = re.sub(r'(https?://[^\s]+)', r'<a href="\1">\1</a>', html_content) html_content = re.sub(r'(https?://[^\s]+)', r'<a href="\1">\1</a>', html_content)
# Wrap in proper HTML
html_content = f"<html><body>{html_content}</body></html>"
dialog = QDialog(self) dialog = QDialog(self)
dialog.setWindowTitle("Amazon Buy List") dialog.setWindowTitle("Amazon Buy List")
dialog.setModal(False) dialog.setModal(True) # Make it modal so it shows
dialog.resize(600, 400) dialog.resize(600, 400)
layout = QVBoxLayout() layout = QVBoxLayout()
@@ -470,7 +471,7 @@ class MainWindow(QMainWindow):
layout.addWidget(buttons) layout.addWidget(buttons)
dialog.setLayout(layout) dialog.setLayout(layout)
dialog.show() dialog.exec() # Use exec() for modal dialog
def closeEvent(self, event): def closeEvent(self, event):
"""Handle window close - minimize to tray instead of closing""" """Handle window close - minimize to tray instead of closing"""