Default to moving existing track when adding a new track
This commit is contained in:
parent
3a14207c71
commit
69bfd3cff9
@ -18,12 +18,19 @@ from tinytag import TinyTag # type: ignore
|
|||||||
from typing import Any, Dict, Optional, Union
|
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"""
|
"""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(
|
def fade_point(
|
||||||
|
|||||||
@ -588,7 +588,8 @@ class PlaylistTab(QTableWidget):
|
|||||||
self.playlist_id)
|
self.playlist_id)
|
||||||
if existing_plr and ask_yes_no("Duplicate row",
|
if existing_plr and ask_yes_no("Duplicate row",
|
||||||
"Track already in playlist. "
|
"Track already in playlist. "
|
||||||
"Move to new location?"):
|
"Move to new location?",
|
||||||
|
default_yes=True):
|
||||||
# Yes it is and we should reuse it
|
# Yes it is and we should reuse it
|
||||||
# If we've been passed a note, we need to add that to the
|
# If we've been passed a note, we need to add that to the
|
||||||
# existing track
|
# existing track
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user