Just log a warning rather than show an error dialog if webkit cannot be imported

svn: r20198
This commit is contained in:
Gary Burton 2012-08-08 21:51:27 +00:00
parent 97f26ed118
commit 0360335899

View File

@ -27,21 +27,44 @@
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gi import Repository
#-------------------------------------------------------------------------
#
# set up logging
#
#-------------------------------------------------------------------------
import logging
_LOG = logging.getLogger("HtmlRenderer")
NOWEB = 0 NOWEB = 0
WEBKIT = 1 WEBKIT = 1
MOZILLA = 2 MOZILLA = 2
TOOLKIT = NOWEB TOOLKIT = NOWEB
try:
from gi.repository import WebKit # Attempting to import webkit gives an error dialog if webkit is not
TOOLKIT = WEBKIT # available so test first and log just a warning to the console instead.
except: repository = Repository.get_default()
##try: if repository.enumerate_versions("WebKit"):
## import gtkmozembed try:
## TOOLKIT = MOZILLA print "import Webkit"
##except: from gi.repository import WebKit
pass TOOLKIT = WEBKIT
except:
##try:
## import gtkmozembed
## TOOLKIT = MOZILLA
##except:
pass
else:
_LOG.warning("Webkit is not installed");
#no interfaces present, we do not register these plugins #no interfaces present, we do not register these plugins
if not (TOOLKIT == NOWEB): if not (TOOLKIT == NOWEB):