Clean up playlists.py

This commit is contained in:
Keith Edmunds 2024-07-30 04:12:35 +01:00
parent 076451ff89
commit b15687a4c6

View File

@ -207,11 +207,14 @@ class PlaylistTab(QTableView):
self.setDragDropMode(QAbstractItemView.DragDropMode.InternalMove)
self.setDragDropOverwriteMode(False)
self.setAcceptDrops(True)
# Set our custom style - this draws the drop indicator across the whole row
self.setStyle(PlaylistStyle())
# We will enable dragging when rows are selected. Disabling it
# here means we can click and drag to select rows.
self.setDragEnabled(False)
# Prepare for context menu
self.menu = QMenu()
self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
@ -229,12 +232,14 @@ class PlaylistTab(QTableView):
# Load playlist rows
self.setModel(self.proxy_model)
self._set_column_widths()
# Stretch last column *after* setting column widths which is
# *much* faster
h_header = self.horizontalHeader()
if isinstance(h_header, QHeaderView):
h_header.sectionResized.connect(self._column_resize)
h_header.setStretchLastSection(True)
# Setting ResizeToContents causes screen flash on load
self.resize_rows()
@ -920,12 +925,6 @@ class PlaylistTab(QTableView):
Implement spanning of cells, initiated by signal
"""
# Commented out as too noisy
# log.debug(
# f"_span_cells({playlist_id=}, {row=}, "
# f"{column=}, {rowSpan=}, {columnSpan=}) {self.playlist_id=}"
# )
if playlist_id != self.playlist_id:
return