diff --git a/app/helpers.py b/app/helpers.py index c0fd1aa..7e0a4d8 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -18,12 +18,19 @@ from tinytag import TinyTag # type: ignore from typing import Any, Dict, Optional, Union -def ask_yes_no(title: str, question: str) -> bool: +def ask_yes_no(title: str, question: str, default_yes: bool = False) -> bool: """Ask question; return True for yes, False for no""" - button_reply = QMessageBox.question(None, title, question) + dlg = QMessageBox() + dlg.setWindowTitle(title) + dlg.setText(question) + dlg.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + dlg.setIcon(QMessageBox.Question) + if default_yes: + dlg.setDefaultButton(QMessageBox.Yes) + button = dlg.exec_() - return button_reply == QMessageBox.Yes + return button == QMessageBox.Yes def fade_point( diff --git a/app/playlists.py b/app/playlists.py index 462b047..3e98f99 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -588,7 +588,8 @@ class PlaylistTab(QTableWidget): self.playlist_id) if existing_plr and ask_yes_no("Duplicate row", "Track already in playlist. " - "Move to new location?"): + "Move to new location?", + default_yes=True): # Yes it is and we should reuse it # If we've been passed a note, we need to add that to the # existing track