From a40a1f2dac83be585a07a6b1d74948f103828bf1 Mon Sep 17 00:00:00 2001 From: C. Scott Ananian Date: Fri, 04 Nov 2011 01:02:15 +0000 Subject: Fix PixbufLoader constructor on GIR/GTK3. GIR has a more direct translation of the various C-level object constructors. Use the appropriate GIR-style constructor, adding alises for correct operation on GTK2. --- diff --git a/TurtleArt/sprites.py b/TurtleArt/sprites.py index 075738f..d9c3a7b 100644 --- a/TurtleArt/sprites.py +++ b/TurtleArt/sprites.py @@ -68,7 +68,7 @@ Example usage: # method for converting SVG to a gtk pixbuf def svg_str_to_pixbuf(svg_string): - pl = GdkPixbuf.PixbufLoader('svg') + pl = GdkPixbuf.PixbufLoader.new_with_type('svg') pl.write(svg_string) pl.close() pixbuf = pl.get_pixbuf() diff --git a/TurtleArt/tasprite_factory.py b/TurtleArt/tasprite_factory.py index 19e38ad..4153a95 100755 --- a/TurtleArt/tasprite_factory.py +++ b/TurtleArt/tasprite_factory.py @@ -1135,7 +1135,7 @@ if __name__ == "__main__": def svg_str_to_pixbuf(svg_string): """ Load pixbuf from SVG string """ - pl = GdkPixbuf.PixbufLoader('svg') + pl = GdkPixbuf.PixbufLoader.new_with_type('svg') pl.write(svg_string) pl.close() pixbuf = pl.get_pixbuf() diff --git a/util/gtkcompat.py b/util/gtkcompat.py index f257db9..6e2bb67 100644 --- a/util/gtkcompat.py +++ b/util/gtkcompat.py @@ -56,7 +56,10 @@ except ValueError, ImportError: new_from_file_at_size = Gdk.pixbuf_new_from_file_at_size new_from_file = Gdk.pixbuf_new_from_file loader_new_with_mime_type = Gdk.pixbuf_loader_new_with_mime_type - PixbufLoader = Gdk.PixbufLoader + class PixbufLoader: + @staticmethod + def new_with_type(type): + return Gdk.PixbufLoader(type) class GdkScreen: width = Gdk.screen_width -- cgit v0.9.1