specify module version before importing

This commit is contained in:
Yann Leboulanger 2015-07-25 22:03:24 +02:00
parent 20a0f9c5a6
commit 2ca42801eb
4 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import sys
import os
import logging
import locale
import gi
from common import config
import nbxmpp
@ -188,7 +189,6 @@ try:
if os.name == 'nt':
os.environ['FS_PLUGIN_PATH'] = 'gtk\\lib\\farstream-0.1'
os.environ['GST_PLUGIN_PATH'] = 'gtk\\lib\\gstreamer-0.10'
import gi
gi.require_version('Farstream', '0.2')
from gi.repository import Farstream
gi.require_version('Gst', '1.0')
@ -208,6 +208,7 @@ except (ImportError, ValueError):
HAVE_UPNP_IGD = True
try:
gi.require_version('GUPnPIgd', '1.0')
from gi.repository import GUPnPIgd
gupnp_igd = GUPnPIgd.SimpleIgd()
except ImportError:

View File

@ -30,6 +30,7 @@ import warnings
from common import gajim
from common import kwalletbinding
from common.exceptions import GnomeKeyringError
import gi
USER_HAS_LIBSECRET = False
USER_HAS_GNOMEKEYRING = False
@ -253,6 +254,7 @@ def get_storage():
if gajim.config.get('use_gnomekeyring'):
global Secret
try:
gi.require_version('Secret', '1')
gir = __import__('gi.repository', globals(), locals(),
['Secret'], 0)
Secret = gir.Secret

View File

@ -28,6 +28,7 @@
##
import xml.sax.saxutils
import gi
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
@ -732,6 +733,7 @@ Description=xmpp
gajim.config.set('check_if_gajim_is_default', False)
try:
gi.require_version('GConf', '2.0')
GConf = importlib.import_module('gi.repository.GConf')
# in try because daemon may not be there
client = GConf.Client.get_default()

View File

@ -46,6 +46,8 @@ if dbus_support.supported:
USER_HAS_PYNOTIFY = True # user has pynotify module
try:
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
Notify.init('Gajim Notification')
except ImportError: