Default to moving existing track when adding a new track

This commit is contained in:
Keith Edmunds 2023-03-25 17:20:10 +00:00
parent 3a14207c71
commit 69bfd3cff9
2 changed files with 12 additions and 4 deletions

View File

@ -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(

View File

@ -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