V3 tweaks
This commit is contained in:
parent
4eabf4a02a
commit
0f1d5117cc
@ -83,6 +83,7 @@ class MusicMusterSignals(QObject):
|
||||
enable_escape_signal = pyqtSignal(bool)
|
||||
end_reset_model_signal = pyqtSignal(int)
|
||||
next_track_changed_signal = pyqtSignal()
|
||||
resize_rows_signal = pyqtSignal(int)
|
||||
row_order_changed_signal = pyqtSignal(int)
|
||||
search_songfacts_signal = pyqtSignal(str)
|
||||
search_wikipedia_signal = pyqtSignal(str)
|
||||
|
||||
@ -1218,8 +1218,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
def search_playlist_clear(self) -> None:
|
||||
"""Tidy up and reset search bar"""
|
||||
|
||||
# Clear the search text
|
||||
self.active_tab().set_search("")
|
||||
# Clean up search bar
|
||||
self.txtSearch.setText("")
|
||||
self.txtSearch.setHidden(True)
|
||||
|
||||
@ -182,6 +182,8 @@ class PlaylistModel(QAbstractTableModel):
|
||||
# Repaint row
|
||||
self.invalidate_row(row_number)
|
||||
|
||||
self.signals.resize_rows_signal.emit(self.playlist_id)
|
||||
|
||||
def background_role(self, row: int, column: int, prd: PlaylistRowData) -> QBrush:
|
||||
"""Return background setting"""
|
||||
|
||||
@ -578,6 +580,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
"""
|
||||
|
||||
count: int = 0
|
||||
unplayed_count: int = 0
|
||||
duration: int = 0
|
||||
|
||||
if prd.note.endswith("+"):
|
||||
@ -595,6 +598,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
else:
|
||||
count += 1
|
||||
if not row_prd.played:
|
||||
unplayed_count += 1
|
||||
duration += row_prd.duration
|
||||
return (
|
||||
f"{prd.note[:-1].strip()} "
|
||||
@ -632,19 +636,21 @@ class PlaylistModel(QAbstractTableModel):
|
||||
stripped_note = prd.note[:-1].strip()
|
||||
if stripped_note:
|
||||
return (
|
||||
f"{stripped_note} [{count} track{'s' if count > 1 else ''}, "
|
||||
f"{ms_to_mmss(duration)} unplayed{end_time_str}]"
|
||||
f"{stripped_note} ["
|
||||
f"{unplayed_count}/{count} track{'s' if count > 1 else ''} "
|
||||
f"({ms_to_mmss(duration)}) unplayed{end_time_str}]"
|
||||
)
|
||||
else:
|
||||
return (
|
||||
f"[Subtotal: {count} track{'s' if count > 1 else ''}, "
|
||||
f"{ms_to_mmss(duration, none='none')} unplayed{end_time_str}]"
|
||||
f"[{unplayed_count}/{count} track{'s' if count > 1 else ''} "
|
||||
f"({ms_to_mmss(duration)}) unplayed{end_time_str}]"
|
||||
)
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
count += 1
|
||||
if not row_prd.played:
|
||||
unplayed_count += 1
|
||||
duration += row_prd.duration
|
||||
|
||||
return prd.note
|
||||
@ -885,6 +891,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
# Carry out the move outside of the session context to ensure
|
||||
# database updated with any note change
|
||||
self.move_rows([existing_prd.plr_rownum], new_row_number)
|
||||
self.signals.resize_rows_signal.emit(self.playlist_id)
|
||||
|
||||
def move_track_to_header(
|
||||
self, header_row_number: int, existing_prd: PlaylistRowData, note: Optional[str]
|
||||
@ -932,6 +939,8 @@ 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
|
||||
@ -965,9 +974,6 @@ class PlaylistModel(QAbstractTableModel):
|
||||
# Update display
|
||||
self.invalidate_row(track_sequence.previous.plr_rownum)
|
||||
|
||||
# Update track times
|
||||
# TODO
|
||||
|
||||
def refresh_data(self, session: scoped_session):
|
||||
"""Populate dicts for data calls"""
|
||||
|
||||
@ -1006,6 +1012,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
set_track_metadata(track)
|
||||
self.refresh_row(session, row_number)
|
||||
self.invalidate_row(row_number)
|
||||
self.signals.resize_rows_signal.emit(self.playlist_id)
|
||||
|
||||
def _reversed_contiguous_row_groups(
|
||||
self, row_numbers: List[int]
|
||||
|
||||
@ -123,7 +123,7 @@ class EscapeDelegate(QStyledItemDelegate):
|
||||
else:
|
||||
edit_index = index
|
||||
|
||||
value = editor.toPlainText()
|
||||
value = editor.toPlainText().strip()
|
||||
self.playlist_model.setData(edit_index, value, Qt.ItemDataRole.EditRole)
|
||||
|
||||
def updateEditorGeometry(self, editor, option, index):
|
||||
@ -187,6 +187,7 @@ class PlaylistTab(QTableView):
|
||||
h_header.setStretchLastSection(True)
|
||||
# self.signals.set_next_track_signal.connect(self._reset_next)
|
||||
self.signals = MusicMusterSignals()
|
||||
self.signals.resize_rows_signal.connect(self.resizeRowsToContents)
|
||||
self.signals.span_cells_signal.connect(self._span_cells)
|
||||
|
||||
# Initialise miscellaneous instance variables
|
||||
@ -583,6 +584,7 @@ class PlaylistTab(QTableView):
|
||||
return
|
||||
|
||||
self.playlist_model.delete_rows(self.selected_model_row_numbers())
|
||||
self.clear_selection()
|
||||
|
||||
def get_selected_rows(self) -> List[int]:
|
||||
"""Return a list of selected row numbers sorted by row"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user