Add note colouring by keyword

Fixes #71
This commit is contained in:
Keith Edmunds 2021-09-24 14:58:35 +01:00
parent 9cf9ef9a59
commit 6ccfae0ab1
2 changed files with 13 additions and 1 deletions

View File

@ -38,6 +38,12 @@ class Config(object):
MILLISECOND_SIGFIGS = 0
MYSQL_CONNECT = os.environ.get('MYSQL_CONNECT') or "mysql+mysqldb://musicmuster:musicmuster@localhost/musicmuster_dev" # noqa E501
NORMALISE_ON_IMPORT = True
NOTE_COLOURS = {
'track': "#ffff00",
'request': "#7cf000",
'wrap': "#fffacd",
'story': "#dda0dd",
}
ROOT = os.environ.get('ROOT') or "/home/kae/music"
TESTMODE = True
TIMER_MS = 500

View File

@ -1028,8 +1028,14 @@ class PlaylistTab(QTableWidget):
if row_time:
next_start_time = row_time
# Set colour
note_colour = Config.COLOUR_NOTES_PLAYLIST
note_text = self.item(row, self.COL_TITLE).text()
note_tokens = note_text.split(":", 1)
if len(note_tokens) == 2:
if note_tokens[0] in Config.NOTE_COLOURS:
note_colour = Config.NOTE_COLOURS[note_tokens[0]]
self._set_row_colour(
row, QColor(Config.COLOUR_NOTES_PLAYLIST)
row, QColor(note_colour)
)
self._set_row_bold(row)