[pygobject/pygobject-3-8] pygtkcompat: Fix for missing methods on Windows



commit b560d6aa628bc006e9ff6adc5d495cf519cc575b
Author: Martin Pitt <martinpitt gnome org>
Date:   Fri Jun 21 07:27:48 2013 +0200

    pygtkcompat: Fix for missing methods on Windows
    
    Deal with non-existing Gtk.Clipboard.get() and
    GdkPixbuf.Pixbuf.new_from_file_at_scale() methods.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702787

 pygtkcompat/pygtkcompat.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py
index 4267a60..67571ac 100644
--- a/pygtkcompat/pygtkcompat.py
+++ b/pygtkcompat/pygtkcompat.py
@@ -139,7 +139,10 @@ def enable_gtk(version='3.0'):
     Gdk.PixbufLoader = GdkPixbuf.PixbufLoader.new_with_type
     Gdk.pixbuf_new_from_data = GdkPixbuf.Pixbuf.new_from_data
     Gdk.pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file
-    Gdk.pixbuf_new_from_file_at_scale = GdkPixbuf.Pixbuf.new_from_file_at_scale
+    try:
+        Gdk.pixbuf_new_from_file_at_scale = GdkPixbuf.Pixbuf.new_from_file_at_scale
+    except AttributeError:
+        pass
     Gdk.pixbuf_new_from_file_at_size = GdkPixbuf.Pixbuf.new_from_file_at_size
     Gdk.pixbuf_new_from_inline = GdkPixbuf.Pixbuf.new_from_inline
     Gdk.pixbuf_new_from_stream = GdkPixbuf.Pixbuf.new_from_stream
@@ -349,7 +352,10 @@ def enable_gtk(version='3.0'):
     Gtk.image_new_from_file = Gtk.Image.new_from_file
     Gtk.settings_get_default = Gtk.Settings.get_default
     Gtk.window_set_default_icon = Gtk.Window.set_default_icon
-    Gtk.clipboard_get = Gtk.Clipboard.get
+    try:
+        Gtk.clipboard_get = Gtk.Clipboard.get
+    except AttributeError:
+        pass
 
     #AccelGroup
     Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]