Reinstate row spanning after note move
This commit is contained in:
parent
b3e3e503ca
commit
301bee4ba5
@ -242,15 +242,25 @@ class Playlist(QTableWidget):
|
||||
for column_index, column_data in enumerate(data):
|
||||
self.setItem(row_index, column_index, column_data)
|
||||
event.accept()
|
||||
for row_index in range(len(rows_to_move)):
|
||||
for column_index in range(self.columnCount()):
|
||||
self.item(drop_row + row_index,
|
||||
column_index).setSelected(True)
|
||||
# We don't want rows to be selected after move
|
||||
# for row_index in range(len(rows_to_move)):
|
||||
# for column_index in range(self.columnCount()):
|
||||
# self.item(drop_row + row_index,
|
||||
# column_index).setSelected(True)
|
||||
# The above doesn't handle column spans, which we use in note
|
||||
# rows. Check and fix:
|
||||
for row in range(drop_row, drop_row + len(rows_to_move)):
|
||||
if row in self.meta_get_notes():
|
||||
self.setSpan(row, self.COL_NOTE, self.NOTE_ROW_SPAN,
|
||||
self.NOTE_COL_SPAN)
|
||||
|
||||
super().dropEvent(event)
|
||||
|
||||
DEBUG(f"Moved row(s) {rows} to become row {drop_row}")
|
||||
DEBUG(
|
||||
"playlist.dropEvent(): "
|
||||
f"Moved row(s) {rows} to become row {drop_row}"
|
||||
)
|
||||
|
||||
self.clearSelection()
|
||||
self.repaint()
|
||||
|
||||
def fade(self):
|
||||
@ -770,7 +780,7 @@ class DbDialog(QDialog):
|
||||
self.ui = Ui_Dialog()
|
||||
self.ui.setupUi(self)
|
||||
self.ui.searchString.textEdited.connect(self.chars_typed)
|
||||
self.ui.matchList.itemDoubleClicked.connect(self.listdclick)
|
||||
self.ui.matchList.itemDoubleClicked.connect(self.double_click)
|
||||
|
||||
record = Settings.get_int("dbdialog_width")
|
||||
width = record.f_int or 800
|
||||
@ -801,17 +811,21 @@ class DbDialog(QDialog):
|
||||
t.setData(Qt.UserRole, track.id)
|
||||
self.ui.matchList.addItem(t)
|
||||
|
||||
def listdclick(self, entry):
|
||||
def double_click(self, entry):
|
||||
track_id = entry.data(Qt.UserRole)
|
||||
track = Tracks.track_from_id(track_id)
|
||||
|
||||
# Store in current playlist in database
|
||||
db_playlist = Playlists.get_playlist_by_id(self.parent().playlist_id)
|
||||
# TODO: hack position to be at end of list
|
||||
db_playlist.add_track(track, 99999)
|
||||
|
||||
db_playlist.add_track(track)
|
||||
# Add to on-screen playlist
|
||||
self.parent().add_to_playlist(track)
|
||||
# Select search text to make it easier for next search
|
||||
self.select_searchtext()
|
||||
|
||||
def select_searchtext(self):
|
||||
self.ui.searchString.selectAll()
|
||||
self.ui.searchString.setFocus()
|
||||
|
||||
|
||||
class SelectPlaylistDialog(QDialog):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user