WIP V3: unplayed rows in bold
This commit is contained in:
parent
6f31ed7afc
commit
ad3ec45a76
@ -50,6 +50,7 @@ class PlaylistRowData:
|
||||
self.lastplayed: datetime = Config.EPOCH
|
||||
self.bitrate = 0
|
||||
self.path = ""
|
||||
self.played = False
|
||||
|
||||
self.plrid: int = plr.id
|
||||
self.plr_rownum: int = plr.plr_rownum
|
||||
@ -59,6 +60,7 @@ class PlaylistRowData:
|
||||
self.title = plr.track.title
|
||||
self.artist = plr.track.artist
|
||||
self.duration = plr.track.duration
|
||||
self.played = plr.played
|
||||
if plr.track.playdates:
|
||||
self.lastplayed = max([a.lastplayed for a in plr.track.playdates])
|
||||
else:
|
||||
@ -307,7 +309,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
elif role == Qt.ItemDataRole.SizeHintRole:
|
||||
pass
|
||||
elif role == Qt.ItemDataRole.FontRole:
|
||||
pass
|
||||
return self.font_role(row, column, prd)
|
||||
elif role == Qt.ItemDataRole.TextAlignmentRole:
|
||||
pass
|
||||
elif role == Qt.ItemDataRole.BackgroundRole:
|
||||
@ -390,6 +392,20 @@ class PlaylistModel(QAbstractTableModel):
|
||||
|
||||
return default
|
||||
|
||||
def font_role(self, row: int, column: int, prd: PlaylistRowData) -> QVariant:
|
||||
"""
|
||||
Return font
|
||||
"""
|
||||
|
||||
# Notes column is never bold
|
||||
if column == Col.NOTE.value:
|
||||
return QVariant()
|
||||
|
||||
boldfont = QFont()
|
||||
boldfont.setBold(not self.playlist_rows[row].played)
|
||||
|
||||
return QVariant(boldfont)
|
||||
|
||||
def headerData(
|
||||
self,
|
||||
section: int,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user