From dc9c1bd20f4fc5b322031087d004baef0536b665 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Fri, 14 May 2021 19:24:22 +0200 Subject: [PATCH] * Added config file options 'appstyle' and 'selstyle' to allow for more flexible application styling. --- ffpreview.conf.sample | 13 ++++++++++--- ffpreview.py | 6 ++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ffpreview.conf.sample b/ffpreview.conf.sample index c9d7741..bf8bc5b 100644 --- a/ffpreview.conf.sample +++ b/ffpreview.conf.sample @@ -12,9 +12,16 @@ thumb_width=128 # Initial thumbnail grid geometry, columns [x rows]. grid=5x5 -# Mouse-over thumbnail highlight color. Either a color name or in a -# hexadecimal color specifier in #RRGGBB notation. -highlightcolor=lightblue +# Application and selected thumbnail style in CSS syntax. +# Examples: +# default theme +# appstyle= +# selstyle=background-color: lightblue; +# dark theme +# appstyle=background-color: #181818; color: #a0a0a0; +# selstyle=background-color: #b0b0b0; color: #202020; +appstyle= +selstyle=background-color: lightblue; # Path to ffprobe. ffprobe=ffprobe diff --git a/ffpreview.py b/ffpreview.py index ff88434..6ff4726 100755 --- a/ffpreview.py +++ b/ffpreview.py @@ -108,7 +108,8 @@ def configure(): 'grid_columns': 5, 'grid_rows': 5, 'thumb_width': '128', - 'highlightcolor': 'lightblue', + 'appstyle': '', + 'selstyle': 'background-color: lightblue;', 'ffprobe': 'ffprobe', 'ffmpeg': 'ffmpeg', 'player': 'mpv --no-ordered-chapters --start=%t %f', @@ -532,7 +533,7 @@ class sMainWindow(QMainWindow): elif idx >= len(l): idx = len(l) - 1 self.cur = idx - l[self.cur].setStyleSheet('QLabel {background-color: %s;}' % cfg['highlightcolor']) + l[self.cur].setStyleSheet( 'QLabel {' + cfg['selstyle'] + '}' ) self.statdsp[3].setText('%d / %d' % (l[self.cur].info[0], self.thinfo['count'])) self.scroll.ensureWidgetVisible(l[self.cur], 0, 0) @@ -560,6 +561,7 @@ class sMainWindow(QMainWindow): self.setWindowIcon(self.ffpreview_ico) self.clipboard = QApplication.clipboard() self.resize(500, 300) + self.setStyleSheet(cfg['appstyle']) self.statbar = QHBoxLayout() self.statdsp = [] -- 2.30.2