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