V3 polish

This commit is contained in:
Keith Edmunds 2023-11-28 21:56:20 +00:00
parent 2e090b192c
commit 6061b20398
3 changed files with 21 additions and 11 deletions

View File

@ -88,7 +88,7 @@ class MusicMusterSignals(QObject):
search_songfacts_signal = pyqtSignal(str)
search_wikipedia_signal = pyqtSignal(str)
show_warning_signal = pyqtSignal(str, str)
span_cells_signal = pyqtSignal(int, int, int, int)
span_cells_signal = pyqtSignal(int, int, int, int, int)
status_message_signal = pyqtSignal(str, int)
def __post_init__(self):

View File

@ -176,7 +176,7 @@ class PlaylistModel(QAbstractTableModel):
plr.note += "\n" + note
# Reset header row spanning
self.signals.span_cells_signal.emit(
row_number, HEADER_NOTES_COLUMN, 1, 1
self.playlist_id, row_number, HEADER_NOTES_COLUMN, 1, 1
)
# Update local copy
self.refresh_row(session, row_number)
@ -366,7 +366,11 @@ class PlaylistModel(QAbstractTableModel):
if self.is_header_row(row):
if column == HEADER_NOTES_COLUMN:
self.signals.span_cells_signal.emit(
row, HEADER_NOTES_COLUMN, 1, self.columnCount() - 1
self.playlist_id,
row,
HEADER_NOTES_COLUMN,
1,
self.columnCount() - 1,
)
header_text = self.header_text(prd)
if not header_text:
@ -796,7 +800,7 @@ class PlaylistModel(QAbstractTableModel):
if self.is_header_row(moving_row):
# Reset column span
self.signals.span_cells_signal.emit(
moving_row, HEADER_NOTES_COLUMN, 1, 1
self.playlist_id, moving_row, HEADER_NOTES_COLUMN, 1, 1
)
# Check to see whether any rows in track_sequence have moved
if track_sequence.previous.plr_rownum in row_map:
@ -961,8 +965,6 @@ class PlaylistModel(QAbstractTableModel):
log.error(f"OBS SDK error ({e})")
return
self.signals.resize_rows_signal.emit(self.playlist_id)
def open_in_audacity(self, row_number: int) -> None:
"""
Open track at passed row number in Audacity
@ -1052,9 +1054,7 @@ class PlaylistModel(QAbstractTableModel):
if now_plr:
track_sequence.now.plr_rownum = now_plr.plr_rownum
if track_sequence.previous.plr_rownum:
previous_plr = session.get(
PlaylistRows, track_sequence.previous.plr_id
)
previous_plr = session.get(PlaylistRows, track_sequence.previous.plr_id)
if previous_plr:
track_sequence.previous.plr_rownum = previous_plr.plr_rownum
@ -1416,7 +1416,9 @@ class PlaylistProxyModel(QSortFilterProxyModel):
# true next time through.
QTimer.singleShot(
Config.HIDE_AFTER_PLAYING_OFFSET + 100,
lambda: self.data_model.invalidate_row(source_row),
lambda: self.data_model.invalidate_row(
source_row
),
)
return True
else:

View File

@ -247,6 +247,9 @@ class PlaylistTab(QTableView):
# Deselect rows
self.clear_selection()
# Resize rows
self.signals.resize_rows_signal.emit(self.playlist_id)
event.accept()
def edit(
@ -679,11 +682,16 @@ class PlaylistTab(QTableView):
self.data_model.set_next_row(model_row_number)
self.clearSelection()
def _span_cells(self, row: int, column: int, rowSpan: int, columnSpan: int) -> None:
def _span_cells(
self, playlist_id: int, row: int, column: int, rowSpan: int, columnSpan: int
) -> None:
"""
Implement spanning of cells, initiated by signal
"""
if playlist_id != self.playlist_id:
return
model = self.proxy_model
if hasattr(model, "mapToSource"):
edit_index = model.mapFromSource(self.data_model.createIndex(row, column))