Fix moving of timing starts and subtotals
This commit is contained in:
parent
48d26d80df
commit
ab8da0a312
@ -249,18 +249,30 @@ class PlaylistTab(QTableWidget):
|
|||||||
else:
|
else:
|
||||||
rowMapping[row + len(rows)] = targetRow + idx
|
rowMapping[row + len(rows)] = targetRow + idx
|
||||||
colCount = self.columnCount()
|
colCount = self.columnCount()
|
||||||
for srcRow, tgtRow in sorted(rowMapping.items()):
|
with Session() as session:
|
||||||
if self._get_row_track_id(srcRow):
|
for srcRow, tgtRow in sorted(rowMapping.items()):
|
||||||
# This is a track row
|
# Messy: will be fixed with model/view implementation.
|
||||||
|
# If we just move the row, the displayed text will be
|
||||||
|
# used. That is incorrect for timing starts, ends and
|
||||||
|
# subtotals, so take text from database and use that.
|
||||||
|
is_header_row = self._get_row_track_id(srcRow) == 0
|
||||||
|
if is_header_row:
|
||||||
|
# This is a header row so save original text from db
|
||||||
|
source_plr = self._get_row_plr(session, srcRow)
|
||||||
|
if not source_plr:
|
||||||
|
print("Can't get source_plr in playlists:dropEvent()")
|
||||||
|
return
|
||||||
|
note_text = source_plr.note
|
||||||
|
# Copy to new locations
|
||||||
for col in range(0, colCount):
|
for col in range(0, colCount):
|
||||||
self.setItem(tgtRow, col, self.takeItem(srcRow, col))
|
self.setItem(tgtRow, col, self.takeItem(srcRow, col))
|
||||||
else:
|
|
||||||
self.setItem(
|
# Fixup header text
|
||||||
tgtRow,
|
if is_header_row:
|
||||||
HEADER_NOTES_COLUMN,
|
target_item = self.item(tgtRow, HEADER_NOTES_COLUMN)
|
||||||
self.takeItem(srcRow, HEADER_NOTES_COLUMN),
|
if target_item:
|
||||||
)
|
target_item.setText(note_text)
|
||||||
self.setSpan(tgtRow, HEADER_NOTES_COLUMN, 1, len(columns) - 1)
|
self.setSpan(tgtRow, HEADER_NOTES_COLUMN, 1, len(columns) - 1)
|
||||||
for row in reversed(sorted(rowMapping.keys())):
|
for row in reversed(sorted(rowMapping.keys())):
|
||||||
self.removeRow(row)
|
self.removeRow(row)
|
||||||
self.resizeRowsToContents()
|
self.resizeRowsToContents()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user