From 624c945534e6a4d1a30d1c6fcfc621b3b27995ab Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Mon, 26 Aug 2013 14:38:06 +0000 Subject: more fine-tuning of the rescaling parameters --- diff --git a/NEWS b/NEWS index 27c0bf9..bf3360e 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ 188 +ENHANCEMENT: +* Add labels to Cartesian coordinate grid + BUG FIXES: * Ensure that default coordinate scale is 1 (pixel mode) * Adjust pen size to coordinate scale diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index c58bbae..50691c8 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -568,7 +568,8 @@ class TurtleArtWindow(): if self.running_sugar: scale = self.height / 800. else: - scale = (self.height + ICON_SIZE) / 800. + scale = self.height / 800. + # scale = (self.height + ICON_SIZE) / 800. self.overlay_shapes['Cartesian'] = Sprite( self.sprite_list, int(self.width / 2 - 600), @@ -740,7 +741,8 @@ class TurtleArtWindow(): if self.running_sugar: y_offset = 0 else: - y_offset = ICON_SIZE + y_offset = 0 + # y_offset = ICON_SIZE self.canvas.draw_surface( self.overlay_shapes[overlay].cached_surfaces[0], (self.canvas.width - width) / 2.0, @@ -748,10 +750,13 @@ class TurtleArtWindow(): width, height) - def update_overlay_position(self, widget, event): + def update_overlay_position(self, widget=None, event=None): ''' Reposition the overlays when window size changes ''' - self.width = event.width - self.height = event.height + # self.width = event.width + # self.height = event.height + self.width = gtk.gdk.screen_width() + self.height = gtk.gdk.screen_height() + for name in OVERLAY_SHAPES: if not name in self.overlay_shapes: continue @@ -760,17 +765,24 @@ class TurtleArtWindow(): if shape in shape._sprites.list: shape.hide() showing = True + self.overlay_shapes[name].move((int(self.width / 2 - 600), + int(self.height / 2 - 450))) + ''' self.overlay_shapes[name] = Sprite( self.sprite_list, int(self.width / 2 - 600), int(self.height / 2 - 450), svg_str_to_pixbuf( svg_from_file('%s/images/%s.svg' % (self.path, name)))) + ''' if showing: self.overlay_shapes[name].set_layer(OVERLAY_LAYER) else: self.overlay_shapes[name].hide() + ''' self.overlay_shapes[name].type = 'overlay' + ''' + self.cartesian = False self.polar = False self.metric = False diff --git a/turtleblocks.py b/turtleblocks.py index b3997db..b6e9fd6 100755 --- a/turtleblocks.py +++ b/turtleblocks.py @@ -220,8 +220,11 @@ return %s(self)" % (p, P, P) cr = cairo.Context(img_surface) surface = cr.get_target() self.turtle_canvas = surface.create_similar( - cairo.CONTENT_COLOR, max(1024, gtk.gdk.screen_width() * 2), - max(768, gtk.gdk.screen_height() * 2)) + cairo.CONTENT_COLOR, + # max(1024, gtk.gdk.screen_width() * 2), + # max(768, gtk.gdk.screen_height() * 2)) + gtk.gdk.screen_width() * 2, + gtk.gdk.screen_height() * 2) self.tw = TurtleArtWindow(self.canvas, self._execdirname, turtle_canvas=self.turtle_canvas, activity=self, running_sugar=False) @@ -577,6 +580,7 @@ Would you like to save before quitting?')) return if self.tw.coord_scale == 1: self.tw.coord_scale = self.tw.height / 40 + self.tw.update_overlay_position() if self.tw.cartesian is True: self.tw.overlay_shapes['Cartesian_labeled'].hide() self.tw.overlay_shapes['Cartesian'].set_layer(OVERLAY_LAYER) -- cgit v0.9.1