diff options
| author | Aaron Spike <aaron@ekips.org> | 2006-05-08 15:28:17 +0000 |
|---|---|---|
| committer | acspike <acspike@users.sourceforge.net> | 2006-05-08 15:28:17 +0000 |
| commit | 5003d4122450f1ea8d75a5f77f96b829908a7dee (patch) | |
| tree | bc478eb71aab76366fd036b788fa2fd4ae9be807 /share/extensions/pturtle.py | |
| parent | More snapping cleanups. (diff) | |
| download | inkscape-5003d4122450f1ea8d75a5f77f96b829908a7dee.tar.gz inkscape-5003d4122450f1ea8d75a5f77f96b829908a7dee.zip | |
standardize indents on 4 spaces
Python hates mixed whitespace
(bzr r770)
Diffstat (limited to 'share/extensions/pturtle.py')
| -rwxr-xr-x | share/extensions/pturtle.py | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/share/extensions/pturtle.py b/share/extensions/pturtle.py index f1806a68b..431c216ed 100755 --- a/share/extensions/pturtle.py +++ b/share/extensions/pturtle.py @@ -18,63 +18,63 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ''' import math class pTurtle: - '''A Python path turtle''' - def __init__(self, home=(0,0)): - self.__home = [home[0], home[1]] - self.__pos = self.__home[:] - self.__heading = -90 - self.__path = "" - self.__draw = True - self.__new = True - def forward(self,mag): - self.setpos((self.__pos[0] + math.cos(math.radians(self.__heading))*mag, - self.__pos[1] + math.sin(math.radians(self.__heading))*mag)) - def backward(self,mag): - self.setpos((self.__pos[0] - math.cos(math.radians(self.__heading))*mag, - self.__pos[1] - math.sin(math.radians(self.__heading))*mag)) - def right(self,deg): - self.__heading -= deg - def left(self,deg): - self.__heading += deg - def penup(self): - self.__draw = False - self.__new = False - def pendown(self): - if not self.__draw: - self.__new = True - self.__draw = True - def pentoggle(self): - if self.__draw: - self.penup() - else: - self.pendown() - def home(self): - self.setpos(self.__home) - def clean(self): - self.__path = '' - def clear(self): - self.clean() - self.home() - def setpos(self,(x,y)): - if self.__new: - self.__path += "M"+",".join([str(i) for i in self.__pos]) - self.__new = False - self.__pos = [x, y] - if self.__draw: - self.__path += "L"+",".join([str(i) for i in self.__pos]) - def getpos(self): - return self.__pos[:] - def setheading(self,deg): - self.__heading = deg - def getheading(self): - return self.__heading - def sethome(self,(x,y)): - self.__home = [x, y] - def getPath(self): - return self.__path - fd = forward - bk = backward - rt = right - lt = left - pu = penup - pd = pendown + '''A Python path turtle''' + def __init__(self, home=(0,0)): + self.__home = [home[0], home[1]] + self.__pos = self.__home[:] + self.__heading = -90 + self.__path = "" + self.__draw = True + self.__new = True + def forward(self,mag): + self.setpos((self.__pos[0] + math.cos(math.radians(self.__heading))*mag, + self.__pos[1] + math.sin(math.radians(self.__heading))*mag)) + def backward(self,mag): + self.setpos((self.__pos[0] - math.cos(math.radians(self.__heading))*mag, + self.__pos[1] - math.sin(math.radians(self.__heading))*mag)) + def right(self,deg): + self.__heading -= deg + def left(self,deg): + self.__heading += deg + def penup(self): + self.__draw = False + self.__new = False + def pendown(self): + if not self.__draw: + self.__new = True + self.__draw = True + def pentoggle(self): + if self.__draw: + self.penup() + else: + self.pendown() + def home(self): + self.setpos(self.__home) + def clean(self): + self.__path = '' + def clear(self): + self.clean() + self.home() + def setpos(self,(x,y)): + if self.__new: + self.__path += "M"+",".join([str(i) for i in self.__pos]) + self.__new = False + self.__pos = [x, y] + if self.__draw: + self.__path += "L"+",".join([str(i) for i in self.__pos]) + def getpos(self): + return self.__pos[:] + def setheading(self,deg): + self.__heading = deg + def getheading(self): + return self.__heading + def sethome(self,(x,y)): + self.__home = [x, y] + def getPath(self): + return self.__path + fd = forward + bk = backward + rt = right + lt = left + pu = penup + pd = pendown |
