Merge pull request #133 from RossGammon/gi_require_version

PyGIWarning: importing without specifiying a version first
This commit is contained in:
Doug Blank 2016-05-08 09:23:00 -04:00
commit 34c8cfdec4
4 changed files with 10 additions and 0 deletions

View File

@ -186,6 +186,8 @@ def show_settings():
""" """
py_str = '%d.%d.%d' % sys.version_info[:3] py_str = '%d.%d.%d' % sys.version_info[:3]
try: try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk from gi.repository import Gtk
try: try:
gtkver_str = '%d.%d.%d' % (Gtk.get_major_version(), gtkver_str = '%d.%d.%d' % (Gtk.get_major_version(),
@ -236,6 +238,8 @@ def show_settings():
from gi import Repository from gi import Repository
repository = Repository.get_default() repository = Repository.get_default()
if repository.enumerate_versions("OsmGpsMap"): if repository.enumerate_versions("OsmGpsMap"):
import gi
gi.require_version('OsmGpsMap', '1.0')
from gi.repository import OsmGpsMap as osmgpsmap from gi.repository import OsmGpsMap as osmgpsmap
try: try:
osmgpsmap_str = osmgpsmap._version osmgpsmap_str = osmgpsmap._version

View File

@ -37,6 +37,8 @@ mechanism for the user to edit address information.
# GTK/Gnome modules # GTK/Gnome modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk from gi.repository import Gtk
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -42,6 +42,8 @@ _ = glocale.translation.gettext
# GNOME/GTK # GNOME/GTK
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gi
gi.require_version('PangoCairo', '1.0')
from gi.repository import PangoCairo from gi.repository import PangoCairo
from gi.repository import GLib from gi.repository import GLib

View File

@ -384,6 +384,8 @@ try:
from gi import Repository from gi import Repository
repository = Repository.get_default() repository = Repository.get_default()
if repository.enumerate_versions("GExiv2"): if repository.enumerate_versions("GExiv2"):
import gi
gi.require_version('GExiv2', '0.10')
from gi.repository import GExiv2 from gi.repository import GExiv2
available = True available = True
else: else: