Avoid show of errordialog if osmgpsmap is not present.

No need to check GTK, GTK3 is required for GUI


svn: r20281
This commit is contained in:
Benny Malengier 2012-08-29 10:03:17 +00:00
parent 6227383508
commit 185883c0ab
2 changed files with 25 additions and 21 deletions

View File

@ -29,27 +29,36 @@
MODULE_VERSION="4.0"
try :
NEWGTK = False
from gi.repository import Gtk
if Gtk.get_major_version() >= 3:
from gi import Repository
#-------------------------------------------------------------------------
#
# set up logging
#
#-------------------------------------------------------------------------
import logging
_LOG = logging.getLogger("Geography")
OSMGPSMAP = False
NEWGTK = True
if NEWGTK:
# Attempting to import OsmGpsMap gives an error dialog if OsmGpsMap is not
# available so test first and log just a warning to the console instead.
repository = Repository.get_default()
if repository.enumerate_versions("OsmGpsMap"):
try :
# current osmgpsmap support GTK3
from gi.repository import OsmGpsMap as osmgpsmap
print "OsmGpsMap version : ", osmgpsmap._version
OSMGPSMAP = True
if osmgpsmap._version < '1.0':
OSMGPSMAP = False
import logging
logging.warning( _("WARNING: osmgpsmap module not loaded. "
_LOG.warning( _("WARNING: osmgpsmap module not loaded. "
"osmgpsmap must be >= 1.0. yours is %s") %
osmgpsmap._version)
else:
_LOG.info("OsmGpsMap loaded, version : " + osmgpsmap._version)
except:
OSMGPSMAP = False
import logging
logging.warning(_("WARNING: osmgpsmap module not loaded. "
_LOG.warning(_("WARNING: osmgpsmap module not loaded. "
"Geography functionality will not be available."))
if OSMGPSMAP:

View File

@ -54,14 +54,9 @@ TOOLKIT = NOWEB
repository = Repository.get_default()
if repository.enumerate_versions("WebKit"):
try:
print "import Webkit"
from gi.repository import WebKit
TOOLKIT = WEBKIT
except:
##try:
## import gtkmozembed
## TOOLKIT = MOZILLA
##except:
pass
else:
_LOG.warning("Webkit is not installed");