From c14e30b6f5ea40b09a6f33979886631ce93af172 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 9 Aug 2016 14:58:51 +0200 Subject: [PATCH] Fix crash when AppIndicator3 is unavailable Convert ValueError to an ImportError (hack!) to allow the fallback code to function. Fixes https://github.com/pwr/Solaar/pull/276 --- lib/solaar/ui/tray.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py index badf6200..29bcd917 100644 --- a/lib/solaar/ui/tray.py +++ b/lib/solaar/ui/tray.py @@ -145,7 +145,11 @@ def _scroll(tray_icon, event, direction=None): try: import gi - gi.require_version('AppIndicator3', '0.1') + try: + gi.require_version('AppIndicator3', '0.1') + except ValueError: + # Treat unavailable versions the same as unavailable packages + raise ImportError from gi.repository import AppIndicator3 if _log.isEnabledFor(_DEBUG):