From a21c349affbc6721ea0e875eea42917bd5b474cc Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 26 Jan 2010 15:06:57 +0000 Subject: work on backward compatibility --- (limited to 'constants.py') diff --git a/constants.py b/constants.py index 2251885..bed0ce1 100644 --- a/constants.py +++ b/constants.py @@ -42,22 +42,23 @@ PORTFOLIO = 6 PALETTE_NAMES = ['turtle', 'pen', 'number', 'flow', 'blocks', 'extras', 'portfolio'] -PALETTES = [['clean', 'forward', 'back', 'left', 'right', 'arc', 'set xy', - 'show', 'set scale', 'set heading', 'scale', 'xcor', 'ycor', 'heading'], - ['pen up','pen down', 'set pen size', 'set text size', - 'set color', 'set shade', 'fill screen', 'pen size', 'text size', 'color', +PALETTES = [['clean', 'forward', 'back', 'left', 'right', 'arc', 'setxy', + 'show', 'setscale', 'setheading', 'scale', 'xcor', 'ycor', 'heading'], + ['penup','pendown', 'setpensize', 'settextsize', + 'setcolor', 'setshade', 'fillscreen', 'pensize', 'textsize', 'color', 'shade'], - ['number', 'plus', 'minus', 'multiply', - 'divide', 'mod', 'square root', 'random', 'greater than', 'less than', - 'equal to', 'and', 'or', 'not'], - ['wait', 'forever', 'repeat', 'if then', 'stop action', 'hspace', + ['number', 'plus2', 'minus2', 'product2', + 'division2', 'remainder2', 'sqrt', 'identity2', + 'random', 'greater', 'less', + 'equal', 'not', 'and', 'or'], + ['wait', 'forever', 'repeat', 'if', 'stopstack', 'hspace', 'vspace'], - ['start', 'def action 1', 'action 1', 'def action 2', - 'action 2', 'def action', 'action', 'store in box 1', 'box 1', - 'store in box 2', 'box 2', 'store in', 'box', 'string'], - ['print', 'left pos', 'top pos', 'right pos', 'bottom pos', 'width', + ['start', 'hat1', 'stack1', 'hat2', + 'stack2', 'hat', 'stack', 'storeinbox1', 'box1', + 'storeinbox2', 'box2', 'storeinbox', 'box', 'string'], + ['print', 'leftpos', 'toppos', 'rightpos', 'bottompos', 'width', 'height'], - ['hide blocks']] + ['hideblocks']] # # block style attributes @@ -77,28 +78,28 @@ STANDARD_STROKE_WIDTH = 1.0 # # block style definitions # -BASIC_STYLE_HEAD = ['start', 'def action 1', 'def action 2'] -BASIC_STYLE_HEAD_1ARG = ['def action'] -BASIC_STYLE_TAIL = ['stop action'] -BASIC_STYLE = ['clean', 'pen up', 'pen down', 'action 1', 'action 2', 'vspace', - 'hide blocks'] -BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'set heading', 'show', - 'set scale', 'set pen size', 'set color', 'set shade', 'print', - 'set text size', 'set text color', 'print', 'wait', 'store in box 1', - 'store in box 2', 'wait', 'action'] -BASIC_STYLE_2ARG = ['arc', 'set xy', 'fill screen', 'store in'] -BOX_STYLE = ['number', 'xcor', 'ycor', 'heading', 'pen size', 'color', 'shade', - 'text color', 'text size', 'box 1', 'box 2', 'string', 'left pos', 'scale', - 'top pos', 'right pos', 'bottom pos', 'width', 'height'] -NUMBER_STYLE = ['plus', 'multiply', 'random'] -NUMBER_STYLE_PORCH = ['minus', 'divide', 'mod'] -NUMBER_STYLE_1ARG = ['square root', 'box'] -COMPARE_STYLE = ['greater than', 'less than', 'equal to'] +BASIC_STYLE_HEAD = ['start', 'hat1', 'hat2'] +BASIC_STYLE_HEAD_1ARG = ['hat'] +BASIC_STYLE_TAIL = ['stopstack'] +BASIC_STYLE = ['clean', 'penup', 'pendown', 'stack1', 'stack2', 'vspace', + 'hideblocks'] +BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'setheading', 'show', + 'setscale', 'setpensize', 'setcolor', 'setshade', 'print', + 'settextsize', 'settextcolor', 'print', 'wait', 'storeinbox1', + 'storeinbox2', 'wait', 'stack'] +BASIC_STYLE_2ARG = ['arc', 'setxy', 'fillscreen', 'storeinbox'] +BOX_STYLE = ['number', 'xcor', 'ycor', 'heading', 'pensize', 'color', 'shade', + 'textcolor', 'textsize', 'box1', 'box2', 'string', 'leftpos', 'scale', + 'toppos', 'rightpos', 'bottompos', 'width', 'height'] +NUMBER_STYLE = ['plus2', 'product2', 'random'] +NUMBER_STYLE_PORCH = ['minus2', 'division2', 'remainder2'] +NUMBER_STYLE_1ARG = ['sqrt', 'box', 'identity2'] +COMPARE_STYLE = ['greater', 'less', 'equal'] BOOLEAN_STYLE = ['and', 'or'] NOT_STYLE = ['not'] FLOW_STYLE = ['forever', 'hspace'] FLOW_STYLE_1ARG = ['repeat'] -FLOW_STYLE_BOOLEAN = ['if then'] +FLOW_STYLE_BOOLEAN = ['if'] # # blocks that contain media @@ -111,46 +112,44 @@ CONTENT_BLOCKS = ['number', 'string', 'media', 'audio', 'journal'] BLOCK_NAMES = {'clean':[_('clean')], 'forward':[_('forward')], 'back':[_('back')], - 'left':[_('left')], 'right':[_('right')], 'set heading':[_('set heading')], - 'show':[_('show')], 'set scale':[_('set scale')], 'xcor':[_('xcor')], - 'ycor':[_('ycor')], 'heading':[_('heading')], 'pen up':[_('pen up')], - 'pen down':[_('pen down')], 'set pen size':[_('set pen size')], + 'left':[_('left')], 'right':[_('right')], 'setheading':[_('set heading')], + 'show':[_('show')], 'setscale':[_('set scale')], 'xcor':[_('xcor')], + 'ycor':[_('ycor')], 'heading':[_('heading')], 'penup':[_('pen up')], + 'pendown':[_('pen down')], 'setpensize':[_('set pen size')], 'arc':[_('arc'),_('angle'),_('radius')], - 'set text size':[_('set text size')], 'set color':[_('set color')], - 'set shade':[_('set shade')], - 'fill screen':[_('fill screen'),_('color'),_('shade')], + 'settextsize':[_('set text size')], 'setcolor':[_('set color')], + 'setshade':[_('set shade')], + 'fillscreen':[_('fill screen'),_('color'),_('shade')], 'shade':[_('shade')], - 'pen size':[_('pen size')], 'text size':[_('text size')], + 'pensize':[_('pen size')], 'textsize':[_('text size')], 'color':[_('color')], - 'plus':['+'], 'minus':['–'], 'multiply':['×'], 'divide':['/'], - 'mod':[_('mod')], - 'random':[_('random'),_('min'),_('max')], 'square root':['√'], - 'less than':['<'], - 'greater than':[">"], 'equal to':['='], 'and':[_('and')], 'or':[_('or')], - 'not':[_('not')], 'print':[_('print')], 'wait':[_('wait')], - 'forever':[_('forever')], 'repeat':[_('repeat')], 'if then':[_('if then')], - 'stop action':[_('stop action')], 'hspace':[' '], 'vspace':[' '], - 'start':[_('start')], 'def action 1':[_('action 1')], - 'action 1':[_('action 1')], - 'def action 2':[_('action 2')], 'action 2':[_('action 2')], - 'def action':[_('action')], 'action':[_('action')], 'number':['100'], - 'store in box 1':[_('store in box 1')], 'box 1':[_('box 1')], - 'store in box 2':[_('store in box 2')], 'box 2':[_('box 2')], - 'store in':[_('store in')], 'box':[_('box')], 'string':[_('string')], - 'left pos':[_('left')], 'top pos':[_('top')], 'right pos':[_('right')], - 'bottom pos':[_('bottom')], 'width':[_('width')], 'height':[_('height')], - 'hide blocks':[_('hide blocks')], - 'set xy':[_('set xy'),_('x'),_('y')], + 'plus2':['+'], 'minus2':['–'], 'product2':['×'], 'division2':['/'], + 'remainder2':[_('mod')], 'identity2':['←'], + 'random':[_('random'),_('min'),_('max')], 'sqrt':['√'], + 'less':['<'],'greater':[">"], 'equal':['='], 'and':[_('and')], + 'not':[_('not')], 'print':[_('print')], 'wait':[_('wait')], 'or':[_('or')], + 'forever':[_('forever')], 'repeat':[_('repeat')], 'if':[_('if then')], + 'stopstack':[_('stop action')], 'hspace':[' '], 'vspace':[' '], + 'start':[_('start')], 'hat1':[_('action 1')], + 'stack1':[_('action 1')], + 'hat2':[_('action 2')], 'stack2':[_('action 2')], + 'hat':[_('action')], 'stack':[_('action')], 'number':['100'], + 'storeinbox1':[_('store in box 1')], 'box1':[_('box 1')], + 'storeinbox2':[_('store in box 2')], 'box2':[_('box 2')], + 'storeinbox':[_('store in')], 'box':[_('box')], 'string':[_('string')], + 'leftpos':[_('left')], 'toppos':[_('top')], 'rightpos':[_('right')], + 'bottompos':[_('bottom')], 'width':[_('width')], 'height':[_('height')], + 'hideblocks':[_('hide blocks')], + 'setxy':[_('set xy'),_('x'),_('y')], 'scale':[_('scale')]} # # Legacy names # -OLD_NAMES = {'setxy':'set xy', 'storeinbox1':'store in box 1', - 'setpensize':'set pen size', 'setshade':'set shade', - 'plus2':'plus', 'division2':'divide','box1':'box 1', - 'box2':'box 2', 'storeinbox2':'store in box 2', - 'division':'divide', 'setcolor':'set color'} +OLD_NAMES = {'product':'product2', + 'division':'division2', 'plus':'plus2', + 'remainder':'remainder2', 'identity':'identity2', + 'division':'division2', 'if else':'if'} # # Logo primitives @@ -158,41 +157,41 @@ OLD_NAMES = {'setxy':'set xy', 'storeinbox1':'store in box 1', PRIMITIVES = {'clean':'clean', 'forward':'forward', 'back':'back', 'arc':'arc', 'left':'left', 'right':'right', 'set heading':'seth', 'scale':'scale', - 'show':'show', 'set scale':'setscale', 'xcor':'xcor', 'set xy':'setxy', - 'ycor':'ycor', 'heading':'heading', 'pen up':'penup', - 'pen down':'pendown', 'set pen size':'setpensize', - 'set text size':'settextsize', 'set color':'setcolor', - 'set shade':'setshade', 'fill screen':'fillscreen', 'shade':'shade', - 'pen size':'pensize', 'text size':'textsize', 'color':'color', - 'plus':'plus', 'minus':'minus', 'multiply':'product', - 'divide':'division', 'mod':'mod', - 'random':'random', 'square root':'sqrt', 'less than':'less?', - 'greater than':'greater?', 'equal to':'equal?', 'and':'and', 'or':'or', + 'show':'show', 'set scale':'setscale', 'xcor':'xcor', 'setxy':'setxy', + 'ycor':'ycor', 'heading':'heading', 'penup':'penup', + 'pendown':'pendown', 'setpensize':'setpensize', + 'settextsize':'settextsize', 'setcolor':'setcolor', + 'setshade':'setshade', 'fillscreen':'fillscreen', 'shade':'shade', + 'pensize':'pensize', 'textsize':'textsize', 'color':'color', + 'plus2':'plus', 'minus2':'minus', 'product2':'product', + 'division2':'division', 'remainder2':'mod', 'identity2':'id', + 'random':'random', 'sqrt':'sqrt', 'less':'less?', + 'greater':'greater?', 'equal':'equal?', 'and':'and', 'or':'or', 'not':'not', 'print':'print', 'wait':'wait', - 'forever':'forever', 'repeat':'repeat', 'if then':'if', 'if else':'ifelse', - 'stop action':'stopstack', 'hspace':'nop', 'vspace':'nop', - 'start':'start', 'def action 1':'nop1', 'action 1':'stack1', - 'def action 2':'nop2', 'action 2':'stack2', - 'def action':'nop3', 'action':'stack', - 'store in box 1':'storeinbox1', 'box 1':'box1', - 'store in box 2':'storeinbox2', 'box 2':'box2', - 'store in':'storeinbox', 'box':'box', - 'left pos':'leftpos', 'top pos':'toppos', 'right pos':'rightpos', - 'bottom pos':'bottompos', 'width':'hres', 'height':'vres', - 'hide blocks':'hideblocks'} + 'forever':'forever', 'repeat':'repeat', 'if':'if', 'ifelse':'ifelse', + 'stopstack':'stopstack', 'hspace':'nop', 'vspace':'nop', + 'start':'start', 'hat1':'nop1', 'stack1':'stack1', + 'hat2':'nop2', 'stack2':'stack2', + 'hat':'nop3', 'action':'stack', + 'storeinbox1':'storeinbox1', 'box1':'box1', + 'storeinbox2':'storeinbox2', 'box2':'box2', + 'storeinbox':'storeinbox', 'box':'box', + 'leftpos':'leftpos', 'toppos':'toppos', 'rightpos':'rightpos', + 'bottompos':'bottompos', 'width':'hres', 'height':'vres', + 'hideblocks':'hideblocks'} # # block default values # DEFAULTS = {'forward':[100], 'back':[100], 'left':[90], 'right':[90], - 'arc':[90,100], 'set heading':[0], 'set scale':[33], 'show':[_('text')], - 'set pen size':[5], 'set text size':[32], 'set color':[0], - 'set shade':[50], 'fill screen':[60,80], 'number':[100], - 'random':[0,100], 'wait':[1], 'repeat':[4], 'set xy':[0,0], - 'store in':[_('my box'),100], 'box':[_('my box')], - 'def action':[_('action')], 'action':[_('action')], - 'store in box 1':[100], 'store in box 2':[100]} + 'arc':[90,100], 'setheading':[0], 'setscale':[33], 'show':[_('text')], + 'setpensize':[5], 'settextsize':[32], 'setcolor':[0], + 'setshade':[50], 'fillscreen':[60,80], 'number':[100], + 'random':[0,100], 'wait':[1], 'repeat':[4], 'setxy':[0,0], + 'storeinbox':[_('my box'),100], 'box':[_('my box')], + 'hat':[_('action')], 'stack':[_('action')], + 'storeinbox1':[100], 'storeinbox2':[100]} # # 'dead key' Unicode dictionaries -- cgit v0.9.1