From b1a9941704e2a8099c102cca9ed2462fd5641c4d Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 23 Sep 2010 16:37:34 +0000 Subject: setxy is for legacy projects --- (limited to 'TurtleArt') diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index 0dc5b5c..4284eb0 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -331,7 +331,7 @@ class TurtleGraphics: self.tw.svg_string += "\"\n" self.tw.svg_string += self.svg.style() - def setxy(self, x, y, share=True): + def setxy(self, x, y, share=True, pendown=True): """ Move turtle to position x,y """ oldx, oldy = self.xcor, self.ycor x *= self.tw.coord_scale @@ -342,7 +342,7 @@ class TurtleGraphics: _logger.debug("bad value sent to %s" % (__name__)) return - if self.pendown: + if self.pendown and pendown: self.gc.set_foreground(self.fgcolor) self.draw_line(oldx, oldy, self.xcor, self.ycor) diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index 0c04552..96df5ad 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -116,7 +116,7 @@ PALETTE_NAMES = ['turtle', 'pen', 'colors', 'numbers', 'flow', 'blocks', 'extras', 'portfolio', 'trash'] PALETTES = [['clean', 'forward', 'back', 'show', 'left', 'right', - 'seth', 'setxy', 'heading', 'xcor', 'ycor', 'setscale', + 'seth', 'setxy2', 'heading', 'xcor', 'ycor', 'setscale', 'arc', 'scale', 'leftpos', 'toppos', 'rightpos', 'bottompos'], ['penup','pendown', 'setpensize', 'fillscreen', 'pensize', @@ -201,7 +201,7 @@ BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'seth', 'show', 'image', 'savesvg', 'setgray', 'skin', 'reskin'] BASIC_STYLE_VAR_ARG = ['userdefined', 'userdefined2args', 'userdefined3args'] BULLET_STYLE = ['templatelist', 'list'] -BASIC_STYLE_2ARG = ['arc', 'setxy', 'fillscreen', 'storein', 'write'] +BASIC_STYLE_2ARG = ['arc', 'setxy', 'setxy2', 'fillscreen', 'storein', 'write'] BOX_STYLE = ['number', 'xcor', 'ycor', 'heading', 'pensize', 'color', 'shade', 'textcolor', 'textsize', 'box1', 'box2', 'string', 'leftpos', 'scale', 'toppos', 'rightpos', 'bottompos', 'width', 'height', 'pop', 'keyboard', @@ -382,6 +382,7 @@ BLOCK_NAMES = { 'settextcolor':[_('set text color')], 'settextsize':[_('set text size')], 'setxy':[_('set xy'), _('x'), _('y')], + 'setxy2':[_('set xy'), _('x'), _('y')], 'shade':[_('shade')], 'show':[_('show')], 'showblocks':[_('show blocks')], @@ -526,6 +527,7 @@ PRIMITIVES = { 'settextsize':'settextsize', 'settextcolor':'settextcolor', 'setxy':'setxy', + 'setxy2':'setxy2', 'shade':'shade', 'show':'show', 'showblocks':'showblocks', @@ -612,6 +614,7 @@ DEFAULTS = { 'settextsize':[48], 'settextcolor':[0], 'setxy':[0, 0], + 'setxy2':[0, 0], 'show':[_('text')], 'showaligned':[_('text')], 'stack':[_('action')], @@ -841,6 +844,7 @@ HELP_STRINGS = { 'settextcolor':_("sets color of text drawn by the turtle"), 'settextsize':_("sets size of text drawn by turtle"), 'setxy':_("moves turtle to position xcor, ycor; (0, 0) is in the center of the screen."), + 'setxy2':_("moves turtle to position xcor, ycor; (0, 0) is in the center of the screen."), 'shade':_("holds current pen shade"), 'show':_("draws text or show media from the Journal"), 'showblocks':_("restores hidden blocks"), @@ -940,7 +944,7 @@ MACROS = { 'picturelist': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -949,7 +953,7 @@ MACROS = { [8, 'show', 0, 0, [6, 9, 10]], [9, ['string',_('Title')], 0, 0, [8, None]], [10, 'penup', 0, 0, [8, 11]], - [11, 'setxy', 0, 0, [10, 12, 13, 14]], + [11, 'setxy2', 0, 0, [10, 12, 13, 14]], [12, 'leftx', 0, 0, [11, None]], [13, 'topy', 0, 0, [11, None]], [14, 'pendown', 0, 0, [11, 15]], @@ -962,7 +966,7 @@ MACROS = { 'picture1x1a': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -971,7 +975,7 @@ MACROS = { [8, 'show', 0, 0, [6, 9, 10]], [9, ['string',_('Title')], 0, 0, [8, None]], [10, 'penup', 0, 0, [8, 11]], - [11, 'setxy', 0, 0, [10, 12, 13, 14]], + [11, 'setxy2', 0, 0, [10, 12, 13, 14]], [12, 'leftx', 0, 0, [11, None]], [13, 'topy', 0, 0, [11, None]], [14, 'pendown', 0, 0, [11, 15]], @@ -983,7 +987,7 @@ MACROS = { 'picture2x2': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -994,28 +998,28 @@ MACROS = { [10, 'setscale', 0, 0, [8, 11, 12]], [11, ['number', '35'], 0, 0, [10, None]], [12, 'penup', 0, 0, [10, 13]], - [13, 'setxy', 0, 0, [12, 14, 15, 16]], + [13, 'setxy2', 0, 0, [12, 14, 15, 16]], [14, 'leftx', 0, 0, [13, None]], [15, 'topy', 0, 0, [13, None]], [16, 'pendown', 0, 0, [13, 17]], [17, 'showaligned', 0, 0, [16, 18, 19]], [18, 'journal', 0, 0, [17, None]], [19, 'penup', 0, 0, [17, 20]], - [20, 'setxy', 0, 0, [19, 21, 22, 23]], + [20, 'setxy2', 0, 0, [19, 21, 22, 23]], [21, 'rightx', 0, 0, [20, None]], [22, 'topy', 0, 0, [20, None]], [23, 'pendown', 0, 0, [20, 24]], [24, 'showaligned', 0, 0, [23, 25, 26]], [25, 'journal', 0, 0, [24, None]], [26, 'penup', 0, 0, [24, 27]], - [27, 'setxy', 0, 0, [26, 28, 29, 30]], + [27, 'setxy2', 0, 0, [26, 28, 29, 30]], [28, 'leftx', 0, 0, [27, None]], [29, 'bottomy', 0, 0, [27, None]], [30, 'pendown', 0, 0, [27, 31]], [31, 'showaligned', 0, 0, [30, 32, 33]], [32, 'journal', 0, 0, [31, None]], [33, 'penup', 0, 0, [31, 34]], - [34, 'setxy', 0, 0, [33, 35, 36, 37]], + [34, 'setxy2', 0, 0, [33, 35, 36, 37]], [35, 'rightx', 0, 0, [34, None]], [36, 'bottomy', 0, 0, [34, None]], [37, 'pendown', 0, 0, [34, 38]], @@ -1025,7 +1029,7 @@ MACROS = { 'picture1x2': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -1036,28 +1040,28 @@ MACROS = { [10, 'setscale', 0, 0, [8, 11, 12]], [11, ['number', '35'], 0, 0, [10, None]], [12, 'penup', 0, 0, [10, 13]], - [13, 'setxy', 0, 0, [12, 14, 15, 16]], + [13, 'setxy2', 0, 0, [12, 14, 15, 16]], [14, 'leftx', 0, 0, [13, None]], [15, 'topy', 0, 0, [13, None]], [16, 'pendown', 0, 0, [13, 17]], [17, 'showaligned', 0, 0, [16, 18, 19]], [18, 'journal', 0, 0, [17, None]], [19, 'penup', 0, 0, [17, 20]], - [20, 'setxy', 0, 0, [19, 21, 22, 23]], + [20, 'setxy2', 0, 0, [19, 21, 22, 23]], [21, 'rightx', 0, 0, [20, None]], [22, 'topy', 0, 0, [20, None]], [23, 'pendown', 0, 0, [20, 24]], [24, 'showaligned', 0, 0, [23, 25, 26]], [25, 'description', 0, 0, [24, None]], [26, 'penup', 0, 0, [24, 27]], - [27, 'setxy', 0, 0, [26, 28, 29, 30]], + [27, 'setxy2', 0, 0, [26, 28, 29, 30]], [28, 'leftx', 0, 0, [27, None]], [29, 'bottomy', 0, 0, [27, None]], [30, 'pendown', 0, 0, [27, 31]], [31, 'showaligned', 0, 0, [30, 32, 33]], [32, 'journal', 0, 0, [31, None]], [33, 'penup', 0, 0, [31, 34]], - [34, 'setxy', 0, 0, [33, 35, 36, 37]], + [34, 'setxy2', 0, 0, [33, 35, 36, 37]], [35, 'rightx', 0, 0, [34, None]], [36, 'bottomy', 0, 0, [34, None]], [37, 'pendown', 0, 0, [34, 38]], @@ -1067,7 +1071,7 @@ MACROS = { 'picture2x1': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -1078,28 +1082,28 @@ MACROS = { [10, 'setscale', 0, 0, [8, 11, 12]], [11, ['number', '35'], 0, 0, [10, None]], [12, 'penup', 0, 0, [10, 13]], - [13, 'setxy', 0, 0, [12, 14, 15, 16]], + [13, 'setxy2', 0, 0, [12, 14, 15, 16]], [14, 'leftx', 0, 0, [13, None]], [15, 'topy', 0, 0, [13, None]], [16, 'pendown', 0, 0, [13, 17]], [17, 'showaligned', 0, 0, [16, 18, 19]], [18, 'journal', 0, 0, [17, None]], [19, 'penup', 0, 0, [17, 20]], - [20, 'setxy', 0, 0, [19, 21, 22, 23]], + [20, 'setxy2', 0, 0, [19, 21, 22, 23]], [21, 'rightx', 0, 0, [20, None]], [22, 'topy', 0, 0, [20, None]], [23, 'pendown', 0, 0, [20, 24]], [24, 'showaligned', 0, 0, [23, 25, 26]], [25, 'journal', 0, 0, [24, None]], [26, 'penup', 0, 0, [24, 27]], - [27, 'setxy', 0, 0, [26, 28, 29, 30]], + [27, 'setxy2', 0, 0, [26, 28, 29, 30]], [28, 'leftx', 0, 0, [27, None]], [29, 'bottomy', 0, 0, [27, None]], [30, 'pendown', 0, 0, [27, 31]], [31, 'showaligned', 0, 0, [30, 32, 33]], [32, 'description', 0, 0, [31, None]], [33, 'penup', 0, 0, [31, 34]], - [34, 'setxy', 0, 0, [33, 35, 36, 37]], + [34, 'setxy2', 0, 0, [33, 35, 36, 37]], [35, 'rightx', 0, 0, [34, None]], [36, 'bottomy', 0, 0, [34, None]], [37, 'pendown', 0, 0, [34, 38]], @@ -1109,7 +1113,7 @@ MACROS = { 'picture1x1': [[0, 'sandwichtop_no_label', 0, 0, [None, 1]], [1, 'penup', 0, 0, [0, 2]], - [2, 'setxy', 0, 0, [1, 3, 4, 5]], + [2, 'setxy2', 0, 0, [1, 3, 4, 5]], [3, 'titlex', 0, 0, [2, None]], [4, 'titley', 0, 0, [2, None]], [5, 'pendown', 0, 0, [2, 6]], @@ -1120,14 +1124,14 @@ MACROS = { [10, 'setscale', 0, 0, [8, 11, 12]], [11, ['number', '35'], 0, 0, [10, None]], [12, 'penup', 0, 0, [10, 13]], - [13, 'setxy', 0, 0, [12, 14, 15, 16]], + [13, 'setxy2', 0, 0, [12, 14, 15, 16]], [14, 'leftx', 0, 0, [13, None]], [15, 'topy', 0, 0, [13, None]], [16, 'pendown', 0, 0, [13, 17]], [17, 'showaligned', 0, 0, [16, 18, 19]], [18, 'journal', 0, 0, [17, None]], [19, 'penup', 0, 0, [17, 20]], - [20, 'setxy', 0, 0, [19, 21, 22, 23]], + [20, 'setxy2', 0, 0, [19, 21, 22, 23]], [21, 'rightx', 0, 0, [20, None]], [22, 'topy', 0, 0, [20, None]], [23, 'pendown', 0, 0, [20, 24]], diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index 4da1afc..0b1c3a6 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -342,7 +342,9 @@ class LogoCode: 'setshade':[1, lambda self, x: self.tw.canvas.setshade(x)], 'settextcolor':[1, lambda self, x: self.tw.canvas.settextcolor(x)], 'settextsize':[1, lambda self, x: self.tw.canvas.settextsize(x)], - 'setxy':[2, lambda self, x, y: self.tw.canvas.setxy(x, y)], + 'setxy2':[2, lambda self, x, y: self.tw.canvas.setxy(x, y)], + 'setxy':[2, lambda self, x, y: self.tw.canvas.setxy(x, y, + pendown=False)], 'shade':[0, lambda self: self.tw.canvas.shade], 'show':[1, lambda self, x: self.show(x, True)], 'showaligned':[1,lambda self, x: self.show(x, False)], @@ -365,7 +367,7 @@ class LogoCode: 't1x2':[3, lambda self, x, y, z: self.show_template1x2(x, y, z)], 't2x1':[3, lambda self, x, y, z: self.show_template2x1(x, y, z)], 't2x2':[5, lambda self, x, y, z, a, b: self.show_template2x2( - x, y, z, a, b)], + x, y, z, a, b)], 'textcolor':[0, lambda self: self.tw.canvas.textcolor], 'textsize':[0, lambda self: self.tw.textsize], 'titlex':[0, lambda self: self.tw.titlex], -- cgit v0.9.1