specify module version before importing

This commit is contained in:
Yann Leboulanger 2015-08-30 23:23:10 +02:00
parent 2f21fb657a
commit b851177f6a
4 changed files with 14 additions and 10 deletions

View File

@ -29,6 +29,7 @@
import os
import time
gi.require_version('GdkX11', '3.0')
from gi.repository import GdkX11
from gi.repository import Gtk
from gi.repository import Gdk

View File

@ -177,11 +177,12 @@ def get_default_font():
Xfce and last KDE it returns None on failure or else a string 'Font Size'
"""
try:
gi.require_version('GConf', '2.0')
from gi.repository import GConf
client = GConf.Client.get_default()
value = client.get_string("/desktop/gnome/interface/font_name")
return value.decode("utf8")
except ImportError:
except ValueError:
pass
# try to get Xfce default font

View File

@ -18,6 +18,7 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
gi.require_version('GtkSpell', '3.0')
from gi.repository import GtkSpell
def ensure_attached(func):

View File

@ -2779,15 +2779,16 @@ class Interface:
gajim.ZEROCONF_ACC_NAME = account
break
# Is gnome configured to activate row on single click ?
try:
from gi.repository import GConf
client = GConf.Client.get_default()
click_policy = client.get_string(
'/apps/nautilus/preferences/click_policy')
if click_policy == 'single':
gajim.single_click = True
except Exception:
pass
# try:
# gi.require_version('GConf', '2.0')
# from gi.repository import GConf
# client = GConf.Client.get_default()
# click_policy = client.get_string(
# '/apps/nautilus/preferences/click_policy')
# if click_policy == 'single':
# gajim.single_click = True
# except Exception:
# pass
# add default status messages if there is not in the config file
if len(gajim.config.get_per('statusmsg')) == 0:
default = gajim.config.statusmsg_default