Merge branch 'dev'

This commit is contained in:
Keith Edmunds 2024-03-25 16:42:25 +00:00
commit 38bb5dc7cd
2 changed files with 7 additions and 11 deletions

View File

@ -789,7 +789,7 @@ class Window(QMainWindow, Ui_MainWindow):
self.active_proxy_model().hide_played_tracks(True)
self.btnHidePlayed.setText("Show played")
# Reset row heights
self.active_tab().resizeRowsToContents()
self.active_tab().resize_rows()
def import_track(self) -> None:
"""Import track file"""
@ -1503,11 +1503,7 @@ class Window(QMainWindow, Ui_MainWindow):
def tab_change(self):
"""Called when active tab changed"""
log.info("tab_change()")
tab = self.active_tab()
if tab:
QTimer.singleShot(300, tab.resizeRowsToContents)
self.active_tab().resize_rows()
def tick_10ms(self) -> None:
"""

View File

@ -209,7 +209,7 @@ class PlaylistTab(QTableView):
h_header.sectionResized.connect(self._column_resize)
h_header.setStretchLastSection(True)
# Setting ResizeToContents causes screen flash on load
QTimer.singleShot(300, self.resizeRowsToContents)
self.resize_rows()
# ########## Overridden class functions ##########
@ -225,7 +225,7 @@ class PlaylistTab(QTableView):
super(PlaylistTab, self).closeEditor(editor, hint)
# Optimise row heights after increasing row height for editing
self.resizeRowsToContents()
self.resize_rows()
# Update start times in case a start time in a note has been
# edited
@ -260,7 +260,7 @@ class PlaylistTab(QTableView):
self.clear_selection()
# Resize rows
self.resizeRowsToContents()
self.resize_rows()
event.accept()
@ -716,14 +716,14 @@ class PlaylistTab(QTableView):
self.source_model.rescan_track(row_number)
self.clear_selection()
def resize_rows(self, playlist_id: int) -> None:
def resize_rows(self, playlist_id: Optional[int] = None) -> None:
"""
If playlist_id is us, resize rows
"""
log.info(f"resize_rows({playlist_id=}) {self.playlist_id=}")
if playlist_id != self.playlist_id:
if playlist_id and playlist_id != self.playlist_id:
return
# self.resizeRowsToContents()