From 95bd2f69d712f39df8d88b58d43a98376b22a186 Mon Sep 17 00:00:00 2001 From: s0600204 <2053873+s0600204@users.noreply.github.com> Date: Sat, 15 Feb 2020 13:06:08 +0000 Subject: [PATCH] Detect qt5ct and workaround it (#198) * Detect qt5ct and workaround it The documentation of python's `os` module recommends modifying `os.environ` directly, rather than using `os.unsetenv()`. (Modifying the former causes the latter to be called; using the latter doesn't update the former.) --- lisp/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/main.py b/lisp/main.py index e022dc8e0..febbdce3c 100644 --- a/lisp/main.py +++ b/lisp/main.py @@ -21,7 +21,7 @@ import logging import sys from itertools import chain -from os import path +from os import environ, path from PyQt5.QtCore import QTranslator, QLocale, QLibraryInfo from PyQt5.QtGui import QFont, QIcon @@ -63,6 +63,11 @@ def main(): level=log ) + # Detect qt5ct (icons do not appear when qt5ct is installed) + if 'QT_QPA_PLATFORMTHEME' in environ and environ['QT_QPA_PLATFORMTHEME'] == 'qt5ct': + logging.warning('qt5ct detected. Linux Show Player and qt5ct are not compatible. Overriding.') + del environ['QT_QPA_PLATFORMTHEME'] + # Create the QApplication qt_app = QApplication(sys.argv) qt_app.setApplicationName('Linux Show Player')