diff options
author | Alexandre Rostovtsev <tetromino@gmail.com> | 2011-08-29 23:05:11 -0400 |
---|---|---|
committer | Eitan Isaacson <eitan@monotonous.org> | 2011-08-31 09:19:27 -0700 |
commit | 1857bd953dc02ac781991f0b97b488b4f300b01f (patch) | |
tree | 49a4315bc8ef9b4c736e3f3e0410daa8cf39a335 /caribou/settings | |
parent | f810f7bfa40fd53bbf2f47d628ad0f0279b24b72 (diff) | |
download | caribou-1857bd953dc02ac781991f0b97b488b4f300b01f.tar.gz |
Use GLib, GObject from gi.repository instead of glib, gobject
Use GLib and GObject from gi.repository instead of glib and gobject
modules for compatibility with pygobject-3.0. Otherwise, when running on
a system with pygobject-2.0 and pygobject-3.0 installed, caribou-preferences
fails with
ImportError: could not import gobject (error was: ImportError('When
using gi.repository you must not import static modules like "gobject".
Please change all occurrences of "import gobject" to "from gi.repository
import GObject".',))
https://bugzilla.gnome.org/show_bug.cgi?id=657666
Diffstat (limited to 'caribou/settings')
-rw-r--r-- | caribou/settings/preferences_window.py | 6 | ||||
-rw-r--r-- | caribou/settings/setting_types.py | 27 |
2 files changed, 16 insertions, 17 deletions
diff --git a/caribou/settings/preferences_window.py b/caribou/settings/preferences_window.py index 55f9fca..541ecb5 100644 --- a/caribou/settings/preferences_window.py +++ b/caribou/settings/preferences_window.py @@ -20,7 +20,7 @@ from caribou.settings.setting_types import * -import gobject +from gi.repository import GObject from gi.repository import Gdk from gi.repository import Gtk @@ -230,7 +230,7 @@ class PreferencesDialog(Gtk.Dialog, AbstractPreferencesUI): __gtype_name__ = "PreferencesDialog" def __init__(self, settings_manager): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) self.set_border_width(6) self.set_title(settings_manager.groups.label) @@ -243,7 +243,7 @@ class PreferencesWindow(Gtk.Window, AbstractPreferencesUI): __gtype_name__ = "PreferencesWindow" def __init__(self, settings_manager): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self.set_border_width(6) self.set_title(settings_manager.groups.label) diff --git a/caribou/settings/setting_types.py b/caribou/settings/setting_types.py index 66fb0f0..c4af2a6 100644 --- a/caribou/settings/setting_types.py +++ b/caribou/settings/setting_types.py @@ -1,5 +1,4 @@ -import gobject -from gi.repository import GLib +from gi.repository import GLib, GObject ENTRY_DEFAULT=0 ENTRY_COMBO=1 @@ -10,17 +9,17 @@ ENTRY_SLIDER=5 ENTRY_CHECKBOX=6 ENTRY_RADIO=7 -class Setting(gobject.GObject): +class Setting(GObject.GObject): __gsignals__ = {'value-changed' : - (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_PYOBJECT,)), + (GObject.SIGNAL_RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_PYOBJECT,)), 'sensitivity-changed' : - (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gobject.TYPE_BOOLEAN,))} + (GObject.SIGNAL_RUN_FIRST, + GObject.TYPE_NONE, + (GObject.TYPE_BOOLEAN,))} def __init__(self, name, label, children=[]): - gobject.GObject.__init__(self) + GObject.GObject.__init__(self) self.name = name self.label = label self.children = children @@ -129,8 +128,8 @@ class IntegerSetting(ValueSetting): variant_type = 'i' entry_type = ENTRY_SPIN def __init__(self, *args, **kwargs): - self.min = kwargs.pop('min', gobject.G_MININT) - self.max = kwargs.pop('max', gobject.G_MAXINT) + self.min = kwargs.pop('min', GObject.G_MININT) + self.max = kwargs.pop('max', GObject.G_MAXINT) ValueSetting.__init__(self, *args, **kwargs) def convert_value(self, val): @@ -140,8 +139,8 @@ class FloatSetting(ValueSetting): variant_type = 'd' entry_type = ENTRY_SPIN def __init__(self, *args, **kwargs): - self.min = kwargs.pop('min', gobject.G_MINFLOAT) - self.max = kwargs.pop('max', gobject.G_MAXFLOAT) + self.min = kwargs.pop('min', GObject.G_MINFLOAT) + self.max = kwargs.pop('max', GObject.G_MAXFLOAT) ValueSetting.__init__(self, *args, **kwargs) def convert_value(self, val): |