WIP V3: preview button works

This commit is contained in:
Keith Edmunds 2023-11-16 18:06:21 +00:00
parent 2861511f1f
commit 93c5475a29
2 changed files with 21 additions and 0 deletions

View File

@ -448,6 +448,13 @@ class PlaylistModel(QAbstractTableModel):
return QVariant(boldfont)
def get_row_track_path(self, row_number: int) -> str:
"""
Return path of track associated with row or empty string if no track associated
"""
return self.playlist_rows[row_number].path
def get_rows_duration(self, row_numbers: List[int]) -> int:
"""
Return the total duration of the passed rows

View File

@ -284,6 +284,20 @@ class PlaylistTab(QTableView):
return index.row()
return None
def get_selected_row_track_path(self) -> str:
"""
Return the path of the selected row. If no row selected or selected
row does not have a track, return empty string.
"""
sm = self.selectionModel()
if sm and sm.hasSelection():
index = sm.currentIndex()
if index.isValid():
model = cast(PlaylistModel, self.model())
return model.get_row_track_path(index.row())
return ""
# def lookup_row_in_songfacts(self) -> None:
# """
# If there is a selected row and it is a track row,