From 6ccfae0ab1331b4ce43c725076e876ba1846b296 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Fri, 24 Sep 2021 14:58:35 +0100 Subject: [PATCH] Add note colouring by keyword Fixes #71 --- app/config.py | 6 ++++++ app/playlists.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/config.py b/app/config.py index 2923db6..a00c91f 100644 --- a/app/config.py +++ b/app/config.py @@ -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 diff --git a/app/playlists.py b/app/playlists.py index cec8338..066bce4 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -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)