Correctly handle determining whether a playlist row is selected.
This commit is contained in:
parent
9ee5730b14
commit
2d247db543
@ -143,12 +143,12 @@ class Playlist(QTableWidget):
|
|||||||
playlist.
|
playlist.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DEBUG(f"add_note({text}): self.currentRow()={self.currentRow()}")
|
if self.selectionModel().hasSelection():
|
||||||
|
row = self.currentRow()
|
||||||
row = self.currentRow()
|
else:
|
||||||
if row < 0:
|
|
||||||
row = self.rowCount()
|
row = self.rowCount()
|
||||||
DEBUG(f"playlist.add_note(): row={row}")
|
DEBUG(f"playlist.add_note(): row={row}")
|
||||||
|
|
||||||
note_id = Notes.add_note(self.playlist_id, row, text)
|
note_id = Notes.add_note(self.playlist_id, row, text)
|
||||||
|
|
||||||
# TODO: this largely duplicates what's in add_to_playlist()
|
# TODO: this largely duplicates what's in add_to_playlist()
|
||||||
@ -169,13 +169,12 @@ class Playlist(QTableWidget):
|
|||||||
Notes object.
|
Notes object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
row = self.currentRow()
|
if self.selectionModel().hasSelection():
|
||||||
if row < 0:
|
row = self.currentRow()
|
||||||
|
else:
|
||||||
row = self.rowCount()
|
row = self.rowCount()
|
||||||
DEBUG(
|
DEBUG(f"add_to_playlist(data={data}): row={row}")
|
||||||
f"currentRow={self.currentRow()} "
|
|
||||||
f"hasSeleciont={self.selectionModel().hasSelection()}"
|
|
||||||
)
|
|
||||||
self.insertRow(row)
|
self.insertRow(row)
|
||||||
|
|
||||||
if isinstance(data, Tracks):
|
if isinstance(data, Tracks):
|
||||||
@ -553,6 +552,9 @@ class Playlist(QTableWidget):
|
|||||||
Sets the selected track as the next track.
|
Sets the selected track as the next track.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not self.selectionModel().hasSelection():
|
||||||
|
return
|
||||||
|
|
||||||
self.set_next(self.currentRow())
|
self.set_next(self.currentRow())
|
||||||
|
|
||||||
def set_next(self, row):
|
def set_next(self, row):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user