diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-04-09 13:08:36 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-04-09 13:08:36 (GMT) |
commit | db528ec468767ce5ed9d4aac4a37a5f8f01ff60f (patch) | |
tree | e74bec92555217a7a0689210da9b5d4708b0174e /TurtleArt/tacanvas.py | |
parent | f00e3fe2182c0bab2b802a7a988a3e0a286c8db5 (diff) |
pep8 cleanup
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r-- | TurtleArt/tacanvas.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index b52743d..6a78a17 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -107,7 +107,7 @@ class TurtleGraphics: self.tw = tw self.width = width self.height = height - + # Build a cairo.Context from a cairo.XlibSurface self.canvas = cairo.Context(self.tw.turtle_canvas) cr = gtk.gdk.CairoContext(self.canvas) @@ -131,7 +131,6 @@ class TurtleGraphics: def setup_svg_surface(self): ''' Set up a surface for saving to SVG ''' - debug_output('Setting up svg surface', True) if self.tw.running_sugar: svg_surface = cairo.SVGSurface( os.path.join(get_path(self.tw.activity, 'instance'), @@ -674,7 +673,8 @@ class TurtleGraphics: if self.tw.interactive_mode: self.tw.active_turtle.move( (int(self.cx + x - self.tw.active_turtle.spr.rect.width / 2.), - int(self.cy + y - self.tw.active_turtle.spr.rect.height / 2.))) + int(self.cy + y - self.tw.active_turtle.spr.rect.height / 2.)) + ) else: self.tw.active_turtle.move((int(self.cx + x), int(self.cy + y))) @@ -722,15 +722,14 @@ class TurtleGraphics: if x < 0 or x > (w - 1) or y < 0 or y > (h - 1): return(-1, -1, -1, -1) # create a new 1x1 cairo surface - cs = cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1); + cs = cairo.ImageSurface(cairo.FORMAT_RGB24, 1, 1) cr = cairo.Context(cs) cr.set_source_surface(self.tw.turtle_canvas, -x, -y) - cr.rectangle(0,0,1,1) + cr.rectangle(0, 0, 1, 1) cr.set_operator(cairo.OPERATOR_SOURCE) cr.fill() - cs.flush() # ensure all writing is done - # Read the pixel - pixels = cs.get_data() + cs.flush() # ensure all writing is done + pixels = cs.get_data() # Read the pixel return (ord(pixels[2]), ord(pixels[1]), ord(pixels[0]), 0) else: return(-1, -1, -1, -1) @@ -763,12 +762,10 @@ class TurtleGraphics: def svg_close(self): ''' Close current SVG graphic ''' - debug_output('svg_close', True) self.cr_svg.show_page() def svg_reset(self): ''' Reset svg flags ''' - debug_output('svg_reset', True) self.cr_svg = None def _get_my_nick(self): |