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" MODULE_VERSION="4.0"
try : from gi import Repository
NEWGTK = False
from gi.repository import Gtk #-------------------------------------------------------------------------
if Gtk.get_major_version() >= 3: #
# set up logging
#
#-------------------------------------------------------------------------
import logging
_LOG = logging.getLogger("Geography")
OSMGPSMAP = False 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 # current osmgpsmap support GTK3
from gi.repository import OsmGpsMap as osmgpsmap from gi.repository import OsmGpsMap as osmgpsmap
print "OsmGpsMap version : ", osmgpsmap._version
OSMGPSMAP = True OSMGPSMAP = True
if osmgpsmap._version < '1.0': if osmgpsmap._version < '1.0':
OSMGPSMAP = False OSMGPSMAP = False
import logging _LOG.warning( _("WARNING: osmgpsmap module not loaded. "
logging.warning( _("WARNING: osmgpsmap module not loaded. "
"osmgpsmap must be >= 1.0. yours is %s") % "osmgpsmap must be >= 1.0. yours is %s") %
osmgpsmap._version) osmgpsmap._version)
else:
_LOG.info("OsmGpsMap loaded, version : " + osmgpsmap._version)
except: except:
OSMGPSMAP = False OSMGPSMAP = False
import logging _LOG.warning(_("WARNING: osmgpsmap module not loaded. "
logging.warning(_("WARNING: osmgpsmap module not loaded. "
"Geography functionality will not be available.")) "Geography functionality will not be available."))
if OSMGPSMAP: if OSMGPSMAP:

View File

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