WIP using signals and no sessions
This commit is contained in:
parent
e9f4ecf5ef
commit
1932719fea
@ -924,9 +924,9 @@ class QueryDialog(QDialog):
|
||||
|
||||
# new_row_number = self.current_row_or_end()
|
||||
# base_model = self.current.base_model
|
||||
for track_id in self.query_dialog.selected_tracks:
|
||||
for track_id in self.selected_tracks:
|
||||
insert_track_data = InsertTrack(self.playlist_id, track_id, note="")
|
||||
self.signals.signal_insert_track.emit(InsertTrack(insert_track_data))
|
||||
self.signals.signal_insert_track.emit(insert_track_data)
|
||||
|
||||
self.accept()
|
||||
|
||||
@ -1584,9 +1584,7 @@ class Window(QMainWindow):
|
||||
else:
|
||||
return None
|
||||
|
||||
def solicit_template_to_use(
|
||||
self, template_prompt: str | None = None
|
||||
) -> int | None:
|
||||
def solicit_template_to_use(self, template_prompt: str | None = None) -> int | None:
|
||||
"""
|
||||
Have user select a template. Return the template.id, or None if they cancel.
|
||||
template_id of zero means don't use a template.
|
||||
@ -1946,7 +1944,7 @@ class Window(QMainWindow):
|
||||
InsertTrack(
|
||||
playlist_id=self.current.base_model.playlist_id,
|
||||
track_id=None,
|
||||
note=dlg.textValue()
|
||||
note=dlg.textValue(),
|
||||
)
|
||||
)
|
||||
|
||||
@ -2001,8 +1999,7 @@ class Window(QMainWindow):
|
||||
# Save the selected PlaylistRows items ready for a later
|
||||
# paste
|
||||
self.move_source = MoveSource(
|
||||
model=self.current.base_model,
|
||||
rows=self.current.selected_row_numbers
|
||||
model=self.current.base_model, rows=self.current.selected_row_numbers
|
||||
)
|
||||
|
||||
log.debug(f"mark_rows_for_moving(): {self.move_source=}")
|
||||
@ -2119,9 +2116,7 @@ class Window(QMainWindow):
|
||||
to_playlist_model.set_next_row(to_row)
|
||||
|
||||
# @log_call
|
||||
def play_next(
|
||||
self, position: float | None = None, checked: bool = False
|
||||
) -> None:
|
||||
def play_next(self, position: float | None = None, checked: bool = False) -> None:
|
||||
"""
|
||||
Play next track, optionally from passed position.
|
||||
|
||||
|
||||
@ -19,10 +19,10 @@ import pyqtgraph as pg # type: ignore
|
||||
# App imports
|
||||
from classes import ApplicationError, MusicMusterSignals, PlaylistRowDTO, singleton
|
||||
from config import Config
|
||||
import helpers
|
||||
from log import log
|
||||
from music_manager import Music
|
||||
import ds
|
||||
import helpers
|
||||
|
||||
|
||||
class PlaylistRow:
|
||||
@ -32,7 +32,8 @@ class PlaylistRow:
|
||||
|
||||
def __init__(self, dto: PlaylistRowDTO) -> None:
|
||||
"""
|
||||
The dto object will include a Tracks object if this row has a track.
|
||||
The dto object will include row information plus a Tracks object
|
||||
if this row has a track.
|
||||
"""
|
||||
|
||||
self.dto = dto
|
||||
@ -64,7 +65,7 @@ class PlaylistRow:
|
||||
|
||||
# Expose TrackDTO fields as properties
|
||||
@property
|
||||
def artist(self):
|
||||
def artist(self) -> str:
|
||||
if self.dto.track:
|
||||
return self.dto.track.artist
|
||||
else:
|
||||
@ -79,28 +80,28 @@ class PlaylistRow:
|
||||
ds.track_update(self.track_id, dict(artist=str(artist)))
|
||||
|
||||
@property
|
||||
def bitrate(self):
|
||||
def bitrate(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.bitrate
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def duration(self):
|
||||
def duration(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.duration
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def fade_at(self):
|
||||
def fade_at(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.fade_at
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def intro(self):
|
||||
def intro(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.intro
|
||||
else:
|
||||
@ -115,35 +116,35 @@ class PlaylistRow:
|
||||
ds.track_update(self.track_id, dict(intro=str(intro)))
|
||||
|
||||
@property
|
||||
def lastplayed(self):
|
||||
def lastplayed(self) -> dt.datetime | None:
|
||||
if self.dto.track:
|
||||
return self.dto.track.lastplayed
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def path(self):
|
||||
def path(self) -> str:
|
||||
if self.dto.track:
|
||||
return self.dto.track.path
|
||||
else:
|
||||
return ""
|
||||
|
||||
@property
|
||||
def silence_at(self):
|
||||
def silence_at(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.silence_at
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def start_gap(self):
|
||||
def start_gap(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.start_gap
|
||||
else:
|
||||
return 0
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
def title(self) -> str:
|
||||
if self.dto.track:
|
||||
return self.dto.track.title
|
||||
else:
|
||||
@ -158,7 +159,7 @@ class PlaylistRow:
|
||||
ds.track_update(self.track_id, dict(title=str(title)))
|
||||
|
||||
@property
|
||||
def track_id(self):
|
||||
def track_id(self) -> int:
|
||||
if self.dto.track:
|
||||
return self.dto.track.track_id
|
||||
else:
|
||||
@ -183,7 +184,7 @@ class PlaylistRow:
|
||||
|
||||
# Expose PlaylistRowDTO fields as properties
|
||||
@property
|
||||
def note(self):
|
||||
def note(self) -> str:
|
||||
return self.dto.note
|
||||
|
||||
@note.setter
|
||||
@ -192,7 +193,7 @@ class PlaylistRow:
|
||||
ds.playlistrow_update_note(self.playlistrow_id, str(note))
|
||||
|
||||
@property
|
||||
def played(self):
|
||||
def played(self) -> bool:
|
||||
return self.dto.played
|
||||
|
||||
@played.setter
|
||||
@ -201,15 +202,15 @@ class PlaylistRow:
|
||||
ds.playlistrow_played(self.playlistrow_id, value)
|
||||
|
||||
@property
|
||||
def playlist_id(self):
|
||||
def playlist_id(self) -> int:
|
||||
return self.dto.playlist_id
|
||||
|
||||
@property
|
||||
def playlistrow_id(self):
|
||||
def playlistrow_id(self) -> int:
|
||||
return self.dto.playlistrow_id
|
||||
|
||||
@property
|
||||
def row_number(self):
|
||||
def row_number(self) -> int:
|
||||
return self.dto.row_number
|
||||
|
||||
@row_number.setter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user