Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2011-11-04 01:02:15 (GMT)
committer C. Scott Ananian <cscott@cscott.net>2011-11-10 03:11:43 (GMT)
commita40a1f2dac83be585a07a6b1d74948f103828bf1 (patch)
treef99ee1ac8fa5a80376426c6899b440f47364025e
parent747e75bb9124f0f133a260c35036d2df17830cf0 (diff)
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.
-rw-r--r--TurtleArt/sprites.py2
-rwxr-xr-xTurtleArt/tasprite_factory.py2
-rw-r--r--util/gtkcompat.py5
3 files changed, 6 insertions, 3 deletions
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