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.lastplayed: datetime = Config.EPOCH
|
||||||
self.bitrate = 0
|
self.bitrate = 0
|
||||||
self.path = ""
|
self.path = ""
|
||||||
|
self.played = False
|
||||||
|
|
||||||
self.plrid: int = plr.id
|
self.plrid: int = plr.id
|
||||||
self.plr_rownum: int = plr.plr_rownum
|
self.plr_rownum: int = plr.plr_rownum
|
||||||
@ -59,6 +60,7 @@ class PlaylistRowData:
|
|||||||
self.title = plr.track.title
|
self.title = plr.track.title
|
||||||
self.artist = plr.track.artist
|
self.artist = plr.track.artist
|
||||||
self.duration = plr.track.duration
|
self.duration = plr.track.duration
|
||||||
|
self.played = plr.played
|
||||||
if plr.track.playdates:
|
if plr.track.playdates:
|
||||||
self.lastplayed = max([a.lastplayed for a in plr.track.playdates])
|
self.lastplayed = max([a.lastplayed for a in plr.track.playdates])
|
||||||
else:
|
else:
|
||||||
@ -307,7 +309,7 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
elif role == Qt.ItemDataRole.SizeHintRole:
|
elif role == Qt.ItemDataRole.SizeHintRole:
|
||||||
pass
|
pass
|
||||||
elif role == Qt.ItemDataRole.FontRole:
|
elif role == Qt.ItemDataRole.FontRole:
|
||||||
pass
|
return self.font_role(row, column, prd)
|
||||||
elif role == Qt.ItemDataRole.TextAlignmentRole:
|
elif role == Qt.ItemDataRole.TextAlignmentRole:
|
||||||
pass
|
pass
|
||||||
elif role == Qt.ItemDataRole.BackgroundRole:
|
elif role == Qt.ItemDataRole.BackgroundRole:
|
||||||
@ -390,6 +392,20 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
|
|
||||||
return default
|
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(
|
def headerData(
|
||||||
self,
|
self,
|
||||||
section: int,
|
section: int,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user