Actually add tracks chosen from query
This commit is contained in:
parent
c9ff1aa668
commit
1749f0a0b8
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
||||
from enum import auto, Enum
|
||||
import functools
|
||||
import threading
|
||||
from typing import NamedTuple, Optional
|
||||
from typing import NamedTuple
|
||||
|
||||
# Third party imports
|
||||
|
||||
@ -97,10 +97,7 @@ class MusicMusterSignals(QObject):
|
||||
"""
|
||||
Class for all MusicMuster signals. See:
|
||||
- https://zetcode.com/gui/pyqt5/eventssignals/
|
||||
- https://stackoverflow.com/questions/62654525/
|
||||
emit-a-signal-from-another-class-to-main-class
|
||||
and Singleton class at
|
||||
https://refactoring.guru/design-patterns/singleton/python/example#example-0
|
||||
- https://stackoverflow.com/questions/62654525/emit-a-signal-from-another-class-to-main-class
|
||||
"""
|
||||
|
||||
begin_reset_model_signal = pyqtSignal(int)
|
||||
|
||||
@ -72,7 +72,7 @@ from classes import (
|
||||
from config import Config
|
||||
from dialogs import TrackSelectDialog
|
||||
from file_importer import FileImporter
|
||||
from helpers import file_is_unreadable, get_name
|
||||
from helpers import ask_yes_no, file_is_unreadable, get_name
|
||||
from log import log
|
||||
from models import db, Playdates, PlaylistRows, Playlists, Queries, Settings, Tracks
|
||||
from music_manager import RowAndTrack, track_sequence
|
||||
@ -1431,7 +1431,27 @@ class Window(QMainWindow):
|
||||
|
||||
# Keep a reference else it will be gc'd
|
||||
self.query_dialog = QueryDialog(session, query_id)
|
||||
self.query_dialog.exec()
|
||||
if self.query_dialog.exec():
|
||||
new_row_number = self.current_row_or_end()
|
||||
base_model = self.current.base_model
|
||||
for track_id in self.query_dialog.selected_tracks:
|
||||
# Check whether track is already in playlist
|
||||
move_existing = False
|
||||
existing_prd = base_model.is_track_in_playlist(track_id)
|
||||
if existing_prd is not None:
|
||||
if ask_yes_no(
|
||||
"Duplicate row",
|
||||
"Track already in playlist. " "Move to new location?",
|
||||
default_yes=True,
|
||||
):
|
||||
move_existing = True
|
||||
|
||||
if move_existing and existing_prd:
|
||||
base_model.move_track_add_note(new_row_number, existing_prd, note="")
|
||||
else:
|
||||
base_model.insert_row(new_row_number, track_id)
|
||||
|
||||
new_row_number += 1
|
||||
|
||||
# # # # # # # # # # Playlist management functions # # # # # # # # # #
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user