Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block.py4
-rw-r--r--constants.py3
-rw-r--r--talogo.py36
-rw-r--r--tawindow.py44
4 files changed, 47 insertions, 40 deletions
diff --git a/block.py b/block.py
index df306ab..a85bdaa 100644
--- a/block.py
+++ b/block.py
@@ -130,10 +130,6 @@ class Block:
self.spr.set_shape(self.shapes[0])
def _new_block_from_factory(self, sprite_list, x, y):
-
- if self.type == 'block':
- print "new block: %s (%d %d)" % (self.name, x, y)
-
self.svg = SVG()
self.svg.set_scale(self.scale)
self.svg.set_gradiant(True)
diff --git a/constants.py b/constants.py
index da7a0e2..777450e 100644
--- a/constants.py
+++ b/constants.py
@@ -180,7 +180,7 @@ PRIMITIVES = {'clean':'clean', 'forward':'forward', 'back':'back', 'arc':'arc',
'stopstack':'stopstack', 'hspace':'nop', 'vspace':'nop',
'start':'start', 'hat1':'nop1', 'stack1':'stack1',
'hat2':'nop2', 'stack2':'stack2',
- 'hat':'nop3', 'action':'stack', 'turtle':'turtle',
+ 'hat':'nop3', 'stack':'stack', 'turtle':'turtle',
'storeinbox1':'storeinbox1', 'box1':'box1',
'storeinbox2':'storeinbox2', 'box2':'box2',
'storeinbox':'storeinbox', 'box':'box',
@@ -242,3 +242,4 @@ NOISE_KEYS = ['Shift_L', 'Shift_R', 'Control_L', 'Caps_Lock', 'Pause',
'Page_Down', 'Page_Up']
WHITE_SPACE = ['space','Tab','Return']
+CURSOR = '█'
diff --git a/talogo.py b/talogo.py
index 28177a8..e7b3f7d 100644
--- a/talogo.py
+++ b/talogo.py
@@ -55,8 +55,10 @@ class symbol:
self.nargs = None
self.fcn = None
- def __str__(self): return self.name
- def __repr__(self): return '#'+self.name
+ def __str__(self):
+ return self.name
+ def __repr__(self):
+ return '#'+self.name
class logoerror(Exception):
def __init__(self, value):
@@ -332,24 +334,32 @@ def prim_define(name, body):
name.nargs, name.fcn = 0, body
name.rprim = True
-def prim_stack(lc,stri):
- if (not lc.stacks.has_key('stack3'+stri)) or \
- lc.stacks['stack3'+stri] is None: raise logoerror("#nostack")
- icall(lc, evline, lc.stacks['stack3'+stri][:]); yield True
+def prim_stack(lc, str):
+ if (not lc.stacks.has_key('stack3'+str)) or lc.stacks['stack3'+str] is None:
+ raise logoerror("#nostack")
+ icall(lc, evline, lc.stacks['stack3'+str][:])
+ yield True
lc.procstop = False
- ireturn(lc); yield True
+ ireturn(lc)
+ yield True
def prim_stack1(lc):
- if lc.stacks['stack1'] is None: raise logoerror("#nostack")
- icall(lc, evline, lc.stacks['stack1'][:]); yield True
+ if lc.stacks['stack1'] is None:
+ raise logoerror("#nostack")
+ icall(lc, evline, lc.stacks['stack1'][:])
+ yield True
lc.procstop = False
- ireturn(lc); yield True
+ ireturn(lc)
+ yield True
def prim_stack2(lc):
- if lc.stacks['stack2'] is None: raise logoerror("#nostack")
- icall(lc, evline, lc.stacks['stack2'][:]); yield True
+ if lc.stacks['stack2'] is None:
+ raise logoerror("#nostack")
+ icall(lc, evline, lc.stacks['stack2'][:])
+ yield True
lc.procstop = False
- ireturn(lc); yield True
+ ireturn(lc)
+ yield True
def prim_stopstack(lc):
lc.procstop = True
diff --git a/tawindow.py b/tawindow.py
index b556054..eefd3f5 100644
--- a/tawindow.py
+++ b/tawindow.py
@@ -1039,27 +1039,27 @@ class TurtleArtWindow():
newspr.set_layer(TOP_LAYER)
self.drag_pos = 20, 20
newblk.connections = [None]*len(newblk.docks)
- print DEFAULTS[newblk.name]
- for i, argvalue in enumerate(DEFAULTS[newblk.name]):
- # skip the first dock position--it is always a connector
- dock = newblk.docks[i+1]
- argname = dock[0]
- if argname == 'unavailable':
- continue
- if (type(argvalue) is str or type(argvalue) is unicode) and\
- argname == 'number':
- argname = 'string'
- (sx, sy) = newspr.get_xy()
- argblk = Block(self.block_list, self.sprite_list,
- argname, 0, 0, 'block', [argvalue])
- argdock = argblk.docks[0]
- nx, ny = sx+dock[2]-argdock[2], sy+dock[3]-argdock[3]
- argblk.spr.move((nx, ny))
- argblk.spr.set_layer(TOP_LAYER)
- argblk.connections = [newblk, None]
- newblk.connections[i+1] = argblk
- self.drag_group = self._find_group(newblk)
- self.block_operation = 'new'
+ if DEFAULTS.has_key(newblk.name):
+ for i, argvalue in enumerate(DEFAULTS[newblk.name]):
+ # skip the first dock position--it is always a connector
+ dock = newblk.docks[i+1]
+ argname = dock[0]
+ if argname == 'unavailable':
+ continue
+ if (type(argvalue) is str or type(argvalue) is unicode) and\
+ argname == 'number':
+ argname = 'string'
+ (sx, sy) = newspr.get_xy()
+ argblk = Block(self.block_list, self.sprite_list,
+ argname, 0, 0, 'block', [argvalue])
+ argdock = argblk.docks[0]
+ nx, ny = sx+dock[2]-argdock[2], sy+dock[3]-argdock[3]
+ argblk.spr.move((nx, ny))
+ argblk.spr.set_layer(TOP_LAYER)
+ argblk.connections = [newblk, None]
+ newblk.connections[i+1] = argblk
+ self.drag_group = self._find_group(newblk)
+ self.block_operation = 'new'
"""
Debugging tools
@@ -1140,7 +1140,7 @@ class TurtleArtWindow():
if block1.name in ('write', 'plus', 'equal', 'less', 'greater',
'template1', 'template2', 'template3',
'template4', 'template6', 'template7', 'nop',
- 'print', 'stack'):
+ 'print', 'stack', 'hat'):
if block1.name == 'write' and d1type == 'string':
if d2type == 'number' or d2type == 'string':
pass