Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 97b396d..40c39e9 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -1,5 +1,5 @@
#Copyright (c) 2007-8, Playful Invention Company.
-#Copyright (c) 2008-11, Walter Bender
+#Copyright (c) 2008-12, Walter Bender
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
@@ -274,7 +274,10 @@ def save_picture(canvas, file_name):
cr = cairo.Context(img_surface)
cr.set_source_surface(x_surface)
cr.paint()
- img_surface.write_to_png(file_name)
+ if type(file_name) == unicode:
+ img_surface.write_to_png(str(file_name.encode('ascii', 'replace')))
+ else:
+ img_surface.write_to_png(str(file_name))
def get_canvas_data(canvas):
@@ -288,13 +291,6 @@ def get_canvas_data(canvas):
return img_surface.get_data()
-def save_svg(string, file_name):
- ''' Write a string to a file. '''
- file_handle = file(file_name, 'w')
- file_handle.write(string)
- file_handle.close()
-
-
def get_pixbuf_from_journal(dsobject, w, h):
''' Load a pixbuf from a Journal object. '''
try:
@@ -798,7 +794,7 @@ def find_blk_below(blk, name):
if blk == None or len(blk.connections) == 0:
return
group = find_group(blk)
- for gblk in _group:
+ for gblk in group:
if gblk.name == name:
return gblk
return None