Set alternate row colous using App.setPalette

This commit is contained in:
Keith Edmunds 2022-08-17 21:12:21 +01:00
parent d267b32c0d
commit 20e9880a03
2 changed files with 10 additions and 1 deletions

View File

@ -11,12 +11,14 @@ class Config(object):
COLOUR_CURRENT_PLAYLIST = "#7eca8f"
COLOUR_CURRENT_TAB = "#248f24"
COLOUR_ENDING_TIMER = "#dc3545"
COLOUR_EVEN_PLAYLIST = "#d9d9d9"
COLOUR_LONG_START = "#dc3545"
COLOUR_NEXT_HEADER = "#fff3cd"
COLOUR_NEXT_PLAYLIST = "#ffc107"
COLOUR_NEXT_TAB = "#b38600"
COLOUR_NORMAL_TAB = "#000000"
COLOUR_NOTES_PLAYLIST = "#b8daff"
COLOUR_ODD_PLAYLIST = "#f2f2f2"
COLOUR_PREVIOUS_HEADER = "#f8d7da"
COLOUR_UNREADABLE = "#dc3545"
COLOUR_WARNING_TIMER = "#ffc107"

View File

@ -9,7 +9,7 @@ from datetime import datetime, timedelta
from typing import List, Optional
from PyQt5.QtCore import QDate, QEvent, Qt, QTime, QTimer
from PyQt5.QtGui import QColor
from PyQt5.QtGui import QColor, QPalette
from PyQt5.QtWidgets import (
QApplication,
QDialog,
@ -74,6 +74,13 @@ class Window(QMainWindow, Ui_MainWindow):
self.previous_track: Optional[TrackData] = None
self.previous_track_position: Optional[int] = None
# Set colours that will be used by playlist row stripes
palette = QPalette()
palette.setColor(QPalette.Base, QColor(Config.COLOUR_EVEN_PLAYLIST))
palette.setColor(QPalette.AlternateBase,
QColor(Config.COLOUR_ODD_PLAYLIST))
self.setPalette(palette)
self.set_main_window_size()
self.lblSumPlaytime = QLabel("")
self.statusbar.addPermanentWidget(self.lblSumPlaytime)