diff options
author | japm48 <japm48@users.noreply.github.com> | 2020-04-18 07:26:22 +0200 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-04-20 15:58:47 -0700 |
commit | 7826795923375fef264070e9af4e21f5932737f6 (patch) | |
tree | 7b03e42368de59c7df466e958d796108c9d727a6 | |
parent | 2b7f14cc39c536ab47b0cef309a31e0669026c26 (diff) |
grc: do not assume gsettings exists
is_dark_theme() should not throw an exception gsettings is not found (can happen in Windows).
-rw-r--r-- | grc/gui/ParamWidgets.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/grc/gui/ParamWidgets.py b/grc/gui/ParamWidgets.py index 79d200ccfd..2089e9cd72 100644 --- a/grc/gui/ParamWidgets.py +++ b/grc/gui/ParamWidgets.py @@ -34,9 +34,13 @@ def have_dark_theme(): theme_name = config.get( 'Settings', Constants.GTK_INI_THEME_NAME_KEY, fallback=None) return is_dark_theme(theme_name) - theme = subprocess.check_output( - ["gsettings", "get", "org.gnome.desktop.interface", "gtk-theme"] - ).decode('utf-8').strip().replace("'", "") + try: + theme = subprocess.check_output( + ["gsettings", "get", "org.gnome.desktop.interface", "gtk-theme"], + stderr=subprocess.DEVNULL + ).decode('utf-8').strip().replace("'", "") + except: + return False return is_dark_theme(theme) def add_style_provider(): |