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:
return QBrush(QColor(Config.COLOUR_BITRATE_OK))
if column == Col.NOTE.value:
with Session() as session:
note_colour = NoteColours.get_colour(session, prd.note)
if note_colour:
return QBrush(QColor(note_colour))
else:
return QBrush()
if prd.note:
with Session() as session:
note_colour = NoteColours.get_colour(session, prd.note)
if note_colour:
return QBrush(QColor(note_colour))
return QBrush()

View File

@ -671,12 +671,9 @@ class PlaylistTab(QTableView):
if not header:
return
# Set width of last column to zero as it's set to stretch
self.setColumnWidth(header.count() - 1, 0)
# Set remaining column widths from settings
# Last column is set to stretch so ignore it here
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"
record = Settings.get_int_settings(session, attr_name)
if record.f_int is not None: