Improve loading time for long playlists

Fixes #199
This commit is contained in:
Keith Edmunds 2023-12-01 17:08:13 +00:00
parent 8f51e790b5
commit 03f19dfb9c
2 changed files with 7 additions and 11 deletions

View File

@ -220,12 +220,11 @@ class PlaylistModel(QAbstractTableModel):
else: else:
return QBrush(QColor(Config.COLOUR_BITRATE_OK)) return QBrush(QColor(Config.COLOUR_BITRATE_OK))
if column == Col.NOTE.value: if column == Col.NOTE.value:
with Session() as session: if prd.note:
note_colour = NoteColours.get_colour(session, prd.note) with Session() as session:
if note_colour: note_colour = NoteColours.get_colour(session, prd.note)
return QBrush(QColor(note_colour)) if note_colour:
else: return QBrush(QColor(note_colour))
return QBrush()
return QBrush() return QBrush()

View File

@ -671,12 +671,9 @@ class PlaylistTab(QTableView):
if not header: if not header:
return return
# Set width of last column to zero as it's set to stretch # Last column is set to stretch so ignore it here
self.setColumnWidth(header.count() - 1, 0)
# Set remaining column widths from settings
with Session() as session: with Session() as session:
for column_number in range(header.count() - 1): for column_number in range(header.count() - 2):
attr_name = f"playlist_col_{column_number}_width" attr_name = f"playlist_col_{column_number}_width"
record = Settings.get_int_settings(session, attr_name) record = Settings.get_int_settings(session, attr_name)
if record.f_int is not None: if record.f_int is not None: