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
This commit is contained in:
Peter Wu 2016-08-09 14:58:51 +02:00
parent 1edd8a577b
commit c14e30b6f5
1 changed files with 5 additions and 1 deletions

View File

@ -145,7 +145,11 @@ def _scroll(tray_icon, event, direction=None):
try: try:
import gi 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 from gi.repository import AppIndicator3
if _log.isEnabledFor(_DEBUG): if _log.isEnabledFor(_DEBUG):