changeset 570:f0252cf111d8

Don’t traceback when GTK+ isn’t available.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 10 Jul 2014 13:53:46 +0200
parents b21922a03830
children e992927f07a8
files pytouhou/menu.py scripts/pytouhou
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/menu.py	Wed Jul 09 16:46:55 2014 +0200
+++ b/pytouhou/menu.py	Thu Jul 10 13:53:46 2014 +0200
@@ -15,11 +15,7 @@
 from pytouhou.utils.helpers import get_logger
 logger = get_logger(__name__)
 
-try:
-    from gi.repository import Gtk, Gdk
-except ImportError:
-    logger.error('GTK+ unavailable, disabling the GUI menu.')
-    raise
+from gi.repository import Gtk, Gdk
 
 import sys
 import re
--- a/scripts/pytouhou	Wed Jul 09 16:46:55 2014 +0200
+++ b/scripts/pytouhou	Thu Jul 10 13:53:46 2014 +0200
@@ -49,8 +49,12 @@
 logger.info('Configuration loaded from: %s', ', '.join(options.paths))
 
 if not args.no_menu:
-    from pytouhou.menu import menu
-    menu(options, args)
+    try:
+        from pytouhou.menu import menu
+    except ImportError:
+        logger.error('GTK+ unavailable, disabling the GUI menu.')
+    else:
+        menu(options, args)
 
 if args.game == 'EoSD':
     from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game