Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--block.py704
-rw-r--r--constants.py621
-rw-r--r--samples/csquiral.ta2
-rw-r--r--samples/curlygates.ta2
5 files changed, 3 insertions, 1327 deletions
diff --git a/NEWS b/NEWS
index 70be512..b0fd7a2 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@
o palette better integrated into Sugar toolbar
o variable-length string blocks
o editable string blocks
+ o paste text from Sugar clipboard to string blocks
o new boolean logic UI
o showblock to compliment hideblock
o fullscreen block
diff --git a/block.py b/block.py
deleted file mode 100644
index ac90fe3..0000000
--- a/block.py
+++ /dev/null
@@ -1,704 +0,0 @@
-# -*- coding: utf-8 -*-
-#Copyright (c) 2010 Walter Bender
-
-#Permission is hereby granted, free of charge, to any person obtaining a copy
-#of this software and associated documentation files (the "Software"), to deal
-#in the Software without restriction, including without limitation the rights
-#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-#copies of the Software, and to permit persons to whom the Software is
-#furnished to do so, subject to the following conditions:
-
-#The above copyright notice and this permission notice shall be included in
-#all copies or substantial portions of the Software.
-
-#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-#THE SOFTWARE.
-
-from constants import *
-from sprite_factory import *
-import sprites
-from gettext import gettext as _
-
-#
-# A class for the list of blocks and everything they share in common
-#
-class Blocks:
- def __init__(self, font_scale_factor = 1):
- self.list = []
- self.font_scale_factor = font_scale_factor
-
- def get_block(self, i):
- if i < 0 or i > len(self.list)-1:
- return(None)
- else:
- return(self.list[i])
-
- def length_of_list(self):
- return(len(self.list))
-
- def append_to_list(self,block):
- self.list.append(block)
-
- def remove_from_list(self, block):
- if block in self.list:
- self.list.remove(block)
-
- def print_list(self, block_type=None):
- for i, block in enumerate(self.list):
- if block_type is None or block_type == block.type:
- print "%d: %s" % (i, block.name)
-
- #
- # sprite utilities
- #
- def spr_to_block(self, spr):
- for b in self.list:
- if spr == b.spr:
- return b
- return None
-
-#
-# A class for the individual blocks
-#
-class Block:
- #
- # TODO:
- # block data should be stored in block, not in block.spr.label
- # Logo code
- # HTML code
- # debug code
- # etc.
- def __init__(self, block_list, sprite_list, name, x, y, type='block',
- values=[], scale=BLOCK_SCALE, colors=["#00FF00","#00A000"]):
- self.spr = None
- self.shapes = []
- self.name = name
- self.colors = colors
- self.scale = scale
- self.docks = None
- self.connections = None
- self.values = []
- self.primitive = None
- self.type = type
- self._dx = 0
- self._ei = 0
- self._ex = 0
- self._ey = 0
- self._font_size = [6.0, 4.5]
- self._left = 2
- self._right = 2
-
- if OLD_NAMES.has_key(self.name):
- self.name = OLD_NAMES[self.name]
-
- for i in range(len(self._font_size)):
- self._font_size[i] *= self.scale*block_list.font_scale_factor
-
- for v in (values):
- self.values.append(v)
-
- self._new_block_from_factory(sprite_list, x, y)
-
- if PRIMITIVES.has_key(name):
- self.primitive = PRIMITIVES[self.name]
-
- block_list.append_to_list(self)
-
- # We need to resize some blocks on the fly.
- def resize(self):
- # make sure the label fits
- lw = self.spr.label_width()
- lwh = self.spr.label_area_dimensions()
- self._dx = (lw-lwh[0])
- if self._dx < 0:
- self._dx = 0
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
-
- # We may want to rescale blocks as well.
- def rescale(self, scale):
- for i in range(len(self._font_size)):
- self._font_size[i] /= self.scale
- self.scale = scale
- for i in range(len(self._font_size)):
- self._font_size[i] *= self.scale
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
-
- # We may want to add "innies"
- def add_arg(self):
- h = self.svg.get_height()
- self._ei += 1
- self.svg.set_show(True)
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
- return self.svg.get_height()-h
-
- # We may want to grow a block vertically.
- def expand_in_y(self, dy):
- self._ey += dy
- self.svg.set_hide(True)
- self.svg.set_show(True)
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
-
- # We may want to grow a block horizontally.
- def expand_in_x(self, dx):
- self._ex += dx
- self.svg.set_hide(True)
- self.svg.set_show(True)
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
-
- def reset_x(self):
- dx = -self._ex
- self._ex = 0
- self.svg.set_hide(False)
- self.svg.set_show(True)
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
- return dx
-
- def reset_y(self):
- dy = -self._ey
- self._ey = 0
- self.svg.set_hide(False)
- self.svg.set_show(True)
- self._make_block(self.svg)
- self.spr.set_shape(self.shapes[0])
- return dy
-
- def get_expand_x_y(self):
- return (self._ex, self._ey)
-
- def _new_block_from_factory(self, sprite_list, x, y):
- self.svg = SVG()
- self.svg.set_scale(self.scale)
- self.svg.set_gradiant(True)
- self.svg.set_innie([False])
- self.svg.set_outie(False)
- self.svg.set_tab(True)
- self.svg.set_slot(True)
-
- if self.name in EXPANDABLE and self.type == 'block':
- self.svg.set_show(True)
-
- self._make_block(self.svg)
- self.spr = sprites.Sprite(sprite_list, x, y, self.shapes[0])
-
- self.spr.set_margins(self._left, self.svg.get_slot_depth(), self._right,
- self.svg.get_slot_depth()*2)
-
- if self.name in CONTENT_BLOCKS and len(self.values) > 0:
- for i, v in enumerate(self.values):
- self._set_labels(i, str(v))
- elif BLOCK_NAMES.has_key(self.name):
- for i, n in enumerate(BLOCK_NAMES[self.name]):
- self._set_labels(i, n)
-
- # Make sure the labels fit.
- self.resize()
-
- def _set_labels(self, i, label):
- if i == 1: # top
- self.spr.set_label_attributes(int(self._font_size[1]+0.5), True,
- "right", "top", i)
- elif i == 2: # bottom
- self.spr.set_label_attributes(int(self._font_size[1]+0.5), True,
- "right", "bottom", i)
- else:
- self.spr.set_label_attributes(int(self._font_size[0]+0.5), True,
- "center", "middle", i)
- self.spr.set_label(label, i)
-
- def _make_block(self, svg):
- self._set_colors(svg)
- self.svg.set_stroke_width(STANDARD_STROKE_WIDTH)
- self.svg.clear_docks()
- self.shapes = []
- if self.name in BASIC_STYLE:
- self._make_basic_style(svg)
- elif self.name in BASIC_STYLE_HEAD:
- self._make_basic_style_head(svg)
- elif self.name in BASIC_STYLE_HEAD_1ARG:
- self._make_basic_style_head_1arg(svg)
- elif self.name in BASIC_STYLE_TAIL:
- self._make_basic_style_tail(svg)
- elif self.name in BASIC_STYLE_1ARG:
- self._make_basic_style_1arg(svg)
- elif self.name in BASIC_STYLE_2ARG:
- self._make_basic_style_2arg(svg)
- elif self.name in BULLET_STYLE:
- self._make_basic_style_var_arg(svg)
- elif self.name in BOX_STYLE:
- self._make_box_style(svg)
- elif self.name in BOX_STYLE_MEDIA:
- self._make_media_style(svg)
- elif self.name in NUMBER_STYLE:
- self._make_number_style(svg)
- elif self.name in NUMBER_STYLE_BLOCK:
- self._make_number_style_block(svg)
- elif self.name in NUMBER_STYLE_1ARG:
- self._make_number_style_1arg(svg)
- elif self.name in NUMBER_STYLE_1STRARG:
- self._make_number_style_1strarg(svg)
- elif self.name in NUMBER_STYLE_PORCH:
- self._make_number_style_porch(svg)
- elif self.name in COMPARE_STYLE:
- self._make_compare_style(svg)
- elif self.name in BOOLEAN_STYLE:
- self._make_boolean_style(svg)
- elif self.name in NOT_STYLE:
- self._make_not_style(svg)
- elif self.name in FLOW_STYLE:
- self._make_flow_style(svg)
- elif self.name in FLOW_STYLE_1ARG:
- self._make_flow_style_1arg(svg)
- elif self.name in FLOW_STYLE_BOOLEAN:
- self._make_flow_style_boolean(svg)
- elif self.name in FLOW_STYLE_ELSE:
- self._make_flow_style_else(svg)
- elif self.name in PORTFOLIO_STYLE_2x2:
- self._make_portfolio_style_2x2(svg)
- elif self.name in PORTFOLIO_STYLE_2x1:
- self._make_portfolio_style_2x1(svg)
- elif self.name in PORTFOLIO_STYLE_1x1:
- self._make_portfolio_style_1x1(svg)
- elif self.name in PORTFOLIO_STYLE_1x2:
- self._make_portfolio_style_1x2(svg)
- else:
- self._make_basic_style(svg)
- print ">>>>> I don't know how to create a %s block" % (self.name)
-
- def _set_colors(self, svg):
- if BOX_COLORS.has_key(self.name):
- self.colors = BOX_COLORS[self.name]
- else:
- for p in range(len(PALETTES)):
- if self.name in PALETTES[p]:
- self.colors = COLORS[p]
- self.svg.set_colors(self.colors)
-
- def _make_basic_style(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self._make_basic_block(svg)
- self.docks = [['flow',True,self.svg.docks[0][0],self.svg.docks[0][1]],
- ['flow',False,self.svg.docks[1][0],self.svg.docks[1][1]]]
- self._left, self._right = 2, 2
-
- def _make_basic_style_head(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_slot(False)
- self.svg.set_cap(True)
- self._make_basic_block(svg)
- self.docks = [['start', True, 0, 0],
- ['flow', False, self.svg.docks[0][0],
- self.svg.docks[0][1]]]
- self._left, self._right = 2, 2
-
- def _make_basic_style_head_1arg(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_innie([True])
- self.svg.set_slot(False)
- self.svg.set_cap(True)
- self._make_basic_block(svg)
- self.docks = [['start', True, 0, 0],
- ['string', False, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['flow', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left, self._right = 2, self.svg.get_innie_width()*1.5
-
- def _make_basic_style_tail(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_tab(False)
- self._make_basic_block(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['unavailable', False, 0, 0]]
-
- def _make_basic_style_1arg(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_innie([True])
- self._make_basic_block(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['flow', False, self.svg.docks[2][0],
- self.svg.docks[2][1]]]
- self._left, self._right = 2, self.svg.get_innie_width()*1.5
-
- def _make_basic_style_2arg(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_innie([True,True])
- self._make_basic_block(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['number', False, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['flow', False, self.svg.docks[3][0],
- self.svg.docks[3][1]]]
- self._left, self._right = 2, self.svg.get_innie_width()*1.5
-
- def _make_basic_style_var_arg(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- innie = [True, True]
- for i in range(self._ei):
- innie.append(True)
- self.svg.set_innie(innie)
- self._make_basic_block(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['string', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['string', False, self.svg.docks[2][0],
- self.svg.docks[2][1], '[']]
- for i in range(self._ei):
- self.docks.append(['string', False, self.svg.docks[i+3][0],
- self.svg.docks[i+3][1]])
- self.docks.append(['flow', False, self.svg.docks[self._ei+3][0],
- self.svg.docks[self._ei+3][1], ']'])
- self._left, self._right = 2, self.svg.get_innie_width()*1.5
-
- def _make_box_style(self, svg):
- self.svg.expand(60+self._dx+self._ex, self._ey)
- self._make_basic_box(svg)
- self.docks = [['number', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['unavailable', False, 0, 0]]
- self._left, self._right = self.svg.docks[1][0], 1
-
- def _make_media_style(self, svg):
- self.svg.expand(40+self._dx+self._ex, 10+self._ey)
- self._make_basic_box(svg)
- self.docks = [['number', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['unavailable', False, 0, 0]]
- self._left, self._right = self.svg.docks[1][0], 1
-
- def _make_number_style(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_innie([True,True])
- self.svg.set_outie(True)
- self.svg.set_tab(False)
- self.svg.set_slot(False)
- self._make_basic_block(svg)
- """
- NOTE: The "outie" is added last, so the dock order in the NUMBER_STYLE
- needs to be modified.
- """
- self.docks = [['number', True, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['number', False, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left = self.svg.docks[2][0]
- self._right = self.svg.get_innie_width()*1.5
-
- def _make_number_style_block(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_innie([True,True])
- self.svg.set_outie(True)
- self.svg.set_tab(False)
- self.svg.set_slot(False)
- self._make_basic_block(svg)
- self.docks = [['number', True, self.svg.docks[2][0],
- self.svg.docks[2][1], '('],
- ['number', False, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['unavailable', False, 0, 0, ')']]
- self._left = self.svg.docks[2][0]
- self._right = self.svg.get_innie_width()*1.5
-
- def _make_number_style_1arg(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_innie([True])
- self.svg.set_outie(True)
- self.svg.set_tab(False)
- self.svg.set_slot(False)
- self._make_basic_block(svg)
- self.docks = [['number', True, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['number', False, self.svg.docks[0][0],
- self.svg.docks[0][1]]]
- self._left, self._right = self.svg.docks[1][0], self.svg.docks[1][0]
-
- def _make_number_style_1strarg(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_innie([True])
- self.svg.set_outie(True)
- self.svg.set_tab(False)
- self.svg.set_slot(False)
- self._make_basic_block(svg)
- self.docks = [['number', True, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['string', False, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['unavailable', False, 0, 0]]
- self._left, self._right = self.svg.docks[1][0], self.svg.docks[1][0]
-
- def _make_number_style_porch(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_innie([True,True])
- self.svg.set_outie(True)
- self.svg.set_tab(False)
- self.svg.set_slot(False)
- self.svg.set_porch(True)
- self._make_basic_block(svg)
- self.docks = [['number', True, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['number', False, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left = self.svg.docks[2][0]
- self._right = self.svg.get_width()-self.svg.docks[0][0]
-
- def _make_compare_style(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self._make_boolean_compare(svg)
- self.docks = [['bool', True, self.svg.docks[0][0],
- self.svg.docks[0][1], '('],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['number', False, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['unavailable', False, 0, 0, ')']]
- self._left, self._right = self.svg.get_width()-self.svg.docks[2][0], 0
-
- def _make_boolean_style(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self._make_boolean_and_or(svg)
- self.docks = [['bool', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['bool', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['bool', False, self.svg.docks[2][0],
- self.svg.docks[2][1]]]
- self._left, self._right = self.svg.get_width()-self.svg.docks[1][0], 0
-
- def _make_not_style(self, svg):
- self.svg.expand(15+self._dx+self._ex, self._ey)
- self._make_boolean_not(svg)
- self.docks = [['bool', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['bool', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._right = self.svg.get_width()-self.svg.docks[1][0]
- self._left = self._right
-
- def _make_flow_style(self, svg):
- self.svg.expand(10+self._dx+self._ex, self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(False)
- self._make_basic_flow(svg)
- # This is an ugly hack.
- if self.name == 'forever':
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['flow', False, self.svg.docks[1][0],
- self.svg.docks[1][1], '['],
- ['unavailable', False, 0, 0, ']']]
- else:
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['flow', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left, self._right = 0, self.svg.get_width()-self.svg.docks[1][0]
-
- def _make_flow_style_1arg(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_innie([True])
- self._make_basic_flow(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['number', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['flow', False, self.svg.docks[2][0],
- self.svg.docks[2][1], '['],
- ['flow', False, self.svg.docks[3][0],
- self.svg.docks[3][1], ']']]
- self._left = 2
- self._right = self.svg.get_width()-self.svg.docks[1][0]+ \
- self.svg.get_innie_width()*1.5
-
- def _make_flow_style_boolean(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_boolean(True)
- self._make_basic_flow(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['bool', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['flow', False, self.svg.docks[2][0],
- self.svg.docks[2][1], '['],
- ['flow', False, self.svg.docks[3][0],
- self.svg.docks[3][1], ']']]
- self._left, self._right = 2, self.svg.get_width()-self.svg.docks[1][0]
-
- def _make_flow_style_else(self, svg):
- self.svg.expand(self._dx+self._ex, self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_else(True)
- self.svg.set_boolean(True)
- self._make_basic_flow(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['bool', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['flow', False, self.svg.docks[3][0],
- self.svg.docks[3][1], '['],
- ['flow', False, self.svg.docks[2][0],
- self.svg.docks[2][1], ']['],
- ['flow', False, self.svg.docks[4][0],
- self.svg.docks[4][1], ']']]
- self._left, self._right = 2, self.svg.get_width()-self.svg.docks[1][0]
-
- def _make_portfolio_style_2x2(self, svg):
- self.svg.expand(30+self._dx+self._ex, 10+self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_innie([True, True, False, True])
- self._make_portfolio(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['string', False, self.svg.docks[6][0],
- self.svg.docks[6][1]],
- ['media', False, self.svg.docks[5][0],
- self.svg.docks[5][1]],
- ['media', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['media', False, self.svg.docks[4][0],
- self.svg.docks[4][1]],
- ['media', False, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['flow', False, self.svg.docks[3][0],
- self.svg.docks[3][1]]]
- self._left, self._right = 2, self.svg.get_width()-2
-
- def _make_portfolio_style_2x1(self, svg):
- self.svg.expand(30+self._dx+self._ex, 10+self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_innie([True, True])
- self._make_portfolio(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['string', False, self.svg.docks[4][0],
- self.svg.docks[4][1]],
- ['media', False, self.svg.docks[3][0],
- self.svg.docks[3][1]],
- ['media', False, self.svg.docks[1][0],
- self.svg.docks[1][1]],
- ['flow', False, self.svg.docks[2][0],
- self.svg.docks[2][1]]]
- self._left, self._right = 2, self.svg.get_width()-2
-
- def _make_portfolio_style_1x2(self, svg):
- self.svg.expand(30+self._dx+self._ex, 15+self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_innie([True, True, False, True])
- self.svg.set_draw_innies(False)
- self._make_portfolio(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['string', False, self.svg.docks[4][0],
- self.svg.docks[4][1]],
- ['media', False, self.svg.docks[3][0],
- self.svg.docks[3][1]],
- ['media', False, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['flow', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left, self._right = 2, self.svg.get_width()-2
-
-
- def _make_portfolio_style_1x1(self, svg):
- self.svg.expand(30+self._dx+self._ex, 15+self._ey)
- self.svg.set_slot(True)
- self.svg.set_tab(True)
- self.svg.set_innie([True, True])
- self.svg.set_draw_innies(False)
- self._make_portfolio(svg)
- self.docks = [['flow', True, self.svg.docks[0][0],
- self.svg.docks[0][1]],
- ['string', False, self.svg.docks[3][0],
- self.svg.docks[3][1]],
- ['media', False, self.svg.docks[2][0],
- self.svg.docks[2][1]],
- ['flow', False, self.svg.docks[1][0],
- self.svg.docks[1][1]]]
- self._left, self._right = 2, self.svg.get_width()-2
-
- def _make_basic_block(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_block()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_block()))
-
- def _make_basic_box(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_box()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_box()))
-
- def _make_portfolio(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.portfolio()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.portfolio()))
-
- def _make_basic_flow(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_flow()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.basic_flow()))
-
- def _make_boolean_compare(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_compare()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_compare()))
-
- def _make_boolean_and_or(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_and_or()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_and_or()))
-
- def _make_boolean_not(self, svg):
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_not()))
- self.width = self.svg.get_width()
- self.height = self.svg.get_height()
- self.svg.set_stroke_width(SELECTED_STROKE_WIDTH)
- self.svg.set_stroke_color(SELECTED_COLOR)
- self.shapes.append(svg_str_to_pixbuf(self.svg.boolean_not()))
diff --git a/constants.py b/constants.py
deleted file mode 100644
index f5ab419..0000000
--- a/constants.py
+++ /dev/null
@@ -1,621 +0,0 @@
-# -*- coding: utf-8 -*-
-#Copyright (c) 2010, Walter Bender
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-from gettext import gettext as _
-
-#
-# sprite layers
-#
-
-HIDE_LAYER = 100
-CANVAS_LAYER = 500
-OVERLAY_LAYER = 525
-TURTLE_LAYER = 550
-BLOCK_LAYER = 600
-CATEGORY_LAYER = 700
-TAB_LAYER = 710
-STATUS_LAYER = 900
-TOP_LAYER = 1000
-
-#
-# block palette categories
-#
-
-PALETTE_NAMES = ['turtle', 'pen', 'colors', 'numbers', 'flow', 'blocks',
- 'extras', 'portfolio', 'trash']
-
-PALETTES = [['forward', 'back', 'clean', 'left', 'right', 'show',
- 'seth', 'setxy', 'heading', 'xcor', 'ycor', 'setscale',
- 'arc', 'scale'],
- ['penup','pendown', 'setpensize', 'fillscreen', 'pensize',
- 'settextsize', 'setcolor', 'setshade', 'textsize', 'color',
- 'shade'],
- [ 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple'],
- ['plus2', 'minus2', 'product2',
- 'division2', 'identity2', 'remainder2', 'sqrt', 'random',
- 'number', 'greater2', 'less2', 'equal2', 'not', 'and2', 'or2'],
- ['wait', 'forever', 'repeat', 'if', 'ifelse', 'hspace',
- 'vspace', 'stopstack'],
- ['hat1', 'stack1', 'hat', 'hat2', 'stack2', 'stack',
- 'storeinbox1', 'storeinbox2', 'string', 'box1', 'box2', 'box',
- 'storein', 'start'],
- ['kbinput', 'push', 'printheap', 'keyboard', 'pop', 'clearheap',
- 'myfunc', 'nop', 'leftpos', 'toppos', 'width', 'rightpos',
- 'bottompos', 'height', 'addturtle', 'print'],
- ['journal', 'audio', 'description', 'templatelist', 'template1x1a',
- 'template1x1', 'template1x2', 'template2x1', 'template2x2',
- 'hideblocks', 'showblocks'],
- ['restore']]
-
-#
-# block style attributes
-#
-
-COLORS = [["#00FF00","#00A000"], ["#00FFFF","#00A0A0"], ["#00FFFF","#00A0A0"],
- ["#FF00FF","#A000A0"], ["#FFC000","#A08000"], ["#FFFF00","#A0A000"],
- ["#FF0000","#A00000"], ["#0000FF","#0000FF"], ["#FFFF00","#A0A000"]]
-
-BOX_COLORS = {'red':["#FF0000","#A00000"],'orange':["#FFD000","#AA8000"],
- 'yellow':["#FFFF00","#A0A000"],'green':["#00FF00","#008000"],
- 'cyan':["#00FFFF","#00A0A0"],'blue':["#0000FF","#000080"],
- 'purple':["#FF00FF","#A000A0"]}
-
-PALETTE_HEIGHT = 120
-PALETTE_WIDTH = 180
-SELECTOR_WIDTH = 55
-ICON_SIZE = 55
-SELECTED_COLOR = "#0000FF"
-SELECTED_STROKE_WIDTH = 1.5
-STANDARD_STROKE_WIDTH = 1.0
-THUMB_W = 80
-THUMB_H = 60
-PYTHON_X = 17
-PYTHON_Y = 8
-MEDIA_X = 37
-MEDIA_Y = 6
-TEMPLATE_X = 24
-TEMPLATE_Y = 18
-PIXBUF_X = 17
-PIXBUF_Y = 2
-BLOCK_SCALE = 2.0
-PALETTE_DEFAULT_SCALE = 1.5
-PALETTE_SCALE = {'template2x2':1.0, 'template1x2':1.0}
-
-#
-# block style definitions
-#
-BASIC_STYLE_HEAD = ['start', 'hat1', 'hat2', 'restore']
-BASIC_STYLE_HEAD_1ARG = ['hat']
-BASIC_STYLE_TAIL = ['stopstack']
-BASIC_STYLE = ['clean', 'penup', 'pendown', 'stack1', 'stack2', 'vspace',
- 'hideblocks', 'showblocks', 'clearheap', 'printheap', 'kbinput']
-BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'seth', 'show',
- 'setscale', 'setpensize', 'setcolor', 'setshade', 'print',
- 'settextsize', 'settextcolor', 'print', 'wait', 'storeinbox1',
- 'storeinbox2', 'wait', 'stack', 'push', 'nop', 'addturtle']
-BASIC_STYLE_2ARG = ['arc', 'setxy', 'fillscreen', 'storein']
-BOX_STYLE = ['number', 'xcor', 'ycor', 'heading', 'pensize', 'color', 'shade',
- 'textcolor', 'textsize', 'box1', 'box2', 'string', 'leftpos', 'scale',
- 'toppos', 'rightpos', 'bottompos', 'width', 'height', 'pop', 'keyboard',
- 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple']
-BOX_STYLE_MEDIA = ['description', 'audio', 'journal']
-NUMBER_STYLE = ['plus2', 'product2', 'myfunc']
-NUMBER_STYLE_BLOCK = ['random']
-NUMBER_STYLE_PORCH = ['minus2', 'division2', 'remainder2']
-NUMBER_STYLE_1ARG = ['sqrt', 'identity2']
-NUMBER_STYLE_1STRARG = ['box']
-COMPARE_STYLE = ['greater2', 'less2', 'equal2']
-BOOLEAN_STYLE = ['and2', 'or2']
-NOT_STYLE = ['not']
-FLOW_STYLE = ['forever', 'hspace']
-FLOW_STYLE_1ARG = ['repeat']
-FLOW_STYLE_BOOLEAN = ['if']
-FLOW_STYLE_ELSE = ['ifelse']
-PORTFOLIO_STYLE_2x2 = ['template2x2']
-BULLET_STYLE = ['templatelist']
-PORTFOLIO_STYLE_1x1 = ['template1x1', 'template1x1a']
-PORTFOLIO_STYLE_2x1 = ['template2x1']
-PORTFOLIO_STYLE_1x2 = ['template1x2']
-
-
-#
-# Macros (groups of blocks)
-#
-MACROS = {
- 'kbinput':[[0, 'forever', 0, 0, [None, 1, None]],
- [1, 'kbinput', 0, 0, [0, 2]],
- [2, 'vspace', 0, 0, [1, 3]],
- [3, 'if', 0, 0, [2, 4, 7, 8]],
- [4, 'greater2', 0, 0, [3, 5, 6, None]],
- [5, 'keyboard', 0, 0, [4, None]],
- [6, ['number', '0'], 0, 0, [4, None]],
- [7, 'stopstack', 0, 0, [3, None]],
- [8, 'vspace', 0, 0, [3, 9]],
- [9, 'wait', 0, 0, [8, 10, None]],
- [10, ['number', '1'], 0, 0, [9, None]]]
- }
-
-#
-# blocks that are expandable
-#
-EXPANDABLE = ['vspace', 'hspace', 'templatelist', 'identity2']
-
-#
-# Old block styles that need dock adjustments
-#
-OLD_DOCK = ['and', 'or']
-
-#
-# blocks that contain media
-#
-CONTENT_BLOCKS = ['number', 'string', 'description', 'audio', 'journal']
-
-#
-# block name dictionary used for labels
-#
-BLOCK_NAMES = {
- 'addturtle':[_('turtle')],
- 'and2':[_('and')],
- 'arc':[_('arc'),_('angle'),_('radius')],
- 'audio':[' '],
- 'back':[_('back')],
- 'blue':[_('blue')],
- 'bottompos':[_('bottom')],
- 'box':[_('box')],
- 'box1':[_('box 1')],
- 'box2':[_('box 2')],
- 'clean':[_('clean')],
- 'clearheap':[_('empty heap')],
- 'color':[_('color')],
- 'cyan':[_('cyan')],
- 'division2':['/'],
- 'equal2':['='],
- 'fillscreen':[_('fill screen'),_('color'),_('shade')],
- 'forever':[_('forever')],
- 'forward':[_('forward')],
- 'greater2':[">"],
- 'green':[_('green')],
- 'hat':[_('action')],
- 'hat1':[_('action 1')],
- 'hat2':[_('action 2')],
- 'heading':[_('heading')],
- 'height':[_('height')],
- 'hideblocks':[_('hide blocks')],
- 'hspace':[' '],
- 'identity2':['←'],
- 'if':[' ',_('if'),_('then')],
- 'ifelse':[' ',_('if'),_('then else')],
- 'journal':[' '],
- 'kbinput':[_('query keyboard')],
- 'keyboard':[_('keyboard')],
- 'left':[_('left')],
- 'leftpos':[_('left')],
- 'less2':['<'],
- 'minus2':['–'],
- 'myfunc':[_('Python'),_('code'),_('value')],
- 'nop':[_(' ')],
- 'not':[_('not')],
- 'number':['100'],
- 'orange':[_('orange')],
- 'or2':[_('or')],
- 'pendown':[_('pen down')],
- 'pensize':[_('pen size')],
- 'penup':[_('pen up')],
- 'plus2':['+'],
- 'pop':[_('pop')],
- 'printheap':[_('show heap')],
- 'print':[_('print')],
- 'product2':['×'],
- 'purple':[_('purple')],
- 'push':[_('push')],
- 'random':[_('random'),_('min'),_('max')],
- 'red':[_('red')],
- 'remainder2':[_('mod')],
- 'repeat':[' ',_('repeat')],
- 'restore':[_('restore')],
- 'rightpos':[_('right')],
- 'right':[_('right')],
- 'scale':[_('scale')],
- 'setcolor':[_('set color')],
- 'seth':[_('set heading')],
- 'setpensize':[_('set pen size')],
- 'setscale':[_('set scale')],
- 'setshade':[_('set shade')],
- 'settextsize':[_('set text size')],
- 'setxy':[_('set xy'),_('x'),_('y')],
- 'shade':[_('shade')],
- 'show':[_('show')],
- 'showblocks':[_('show blocks')],
- 'sqrt':['√'],
- 'stack':[_('action')],
- 'stack1':[_('action 1')],
- 'stack2':[_('action 2')],
- 'start':[_('start')],
- 'stopstack':[_('stop action')],
- 'storein':[_('store in')],
- 'storeinbox1':[_('store in box 1')],
- 'storeinbox2':[_('store in box 2')],
- 'string':[_('text')],
- 'template1x1':[' '],
- 'template1x1a':[' '],
- 'template1x2':[' '],
- 'template2x1':[' '],
- 'template2x2':[' '],
- 'templatelist':[' '],
- 'textsize':[_('text size')],
- 'toppos':[_('top')],
- 'turtle':[_('turtle')],
- 'vspace':[' '],
- 'wait':[_('wait')],
- 'width':[_('width')],
- 'xcor':[_('xcor')],
- 'ycor':[_('ycor')],
- 'yellow':[_('yellow')]}
-
-#
-# Logo primitives
-#
-
-PRIMITIVES = {
- 'addturtle':'turtle',
- 'and2':'and',
- 'arc':'arc',
- 'back':'back',
- 'blue':'blue',
- 'bottompos':'bpos',
- 'box1':'box1',
- 'box2':'box2',
- 'box':'box',
- 'clean':'clean',
- 'clearheap':'clearheap',
- 'color':'color',
- 'cyan':'cyan',
- 'division2':'division',
- 'equal2':'equal?',
- 'fillscreen':'fillscreen',
- 'forever':'forever',
- 'forward':'forward',
- 'greater2':'greater?',
- 'green':'green',
- 'hat':'nop3',
- 'hat1':'nop1',
- 'hat2':'nop2',
- 'heading':'heading',
- 'height':'vres',
- 'hideblocks':'hideblocks',
- 'hspace':'nop',
- 'identity2':'id',
- 'if':'if',
- 'ifelse':'ifelse',
- 'kbinput':'kbinput',
- 'keyboard':'keyboard',
- 'left':'left',
- 'leftpos':'lpos',
- 'less2':'less?',
- 'templatelist':'bullet',
- 'minus2':'minus',
- 'myfunc':'myfunc',
- 'nop':'userdefined',
- 'not':'not',
- 'orange':'orange',
- 'or2':'or',
- 'pendown':'pendown',
- 'pensize':'pensize',
- 'penup':'penup',
- 'plus2':'plus',
- 'pop':'pop',
- 'printheap':'printheap',
- 'print':'print',
- 'product2':'product',
- 'purple':'purple',
- 'push':'push',
- 'random':'random',
- 'red':'red',
- 'remainder2':'mod',
- 'repeat':'repeat',
- 'rightpos':'rpos',
- 'right':'right',
- 'scale':'scale',
- 'setcolor':'setcolor',
- 'seth':'seth',
- 'setpensize':'setpensize',
- 'setscale':'setscale',
- 'setshade':'setshade',
- 'settextsize':'settextsize',
- 'settextcolor':'settextcolor',
- 'setxy':'setxy',
- 'shade':'shade',
- 'show':'show',
- 'showblocks':'showblocks',
- 'sqrt':'sqrt',
- 'stack':'stack',
- 'stack1':'stack1',
- 'stack2':'stack2',
- 'start':'start',
- 'stopstack':'stopstack',
- 'storein':'storeinbox',
- 'storeinbox1':'storeinbox1',
- 'storeinbox2':'storeinbox2',
- 'template1x1':'t1x1',
- 'template1x1a':'t1x1a',
- 'template1x2':'t1x2',
- 'template2x1':'t2x1',
- 'template2x2':'t2x2',
- 'textsize':'textsize',
- 'toppos':'tpos',
- 'vspace':'nop',
- 'wait':'wait',
- 'width':'hres',
- 'xcor':'xcor',
- 'ycor':'ycor',
- 'yellow':'yellow'}
-
-#
-# block default values
-#
-
-DEFAULTS = {
- 'addturtle':[1],
- 'arc':[90,100],
- 'audio':[None],
- 'back':[100],
- 'box':[_('my box')],
- 'description':[None],
- 'fillscreen':[60,80],
- 'forward':[100],
- 'hat':[_('action')],
- 'if':[None, None, 'vspace'],
- 'ifelse':[None,'vspace', None, 'vspace'],
- 'journal':[None],
- 'left':[90],
- 'media':[None],
- 'myfunc':[_('x'),100],
- 'nop':[100],
- 'number':[100],
- 'random':[0,100],
- 'repeat':[4, None, 'vspace'],
- 'right':[90],
- 'setcolor':[0],
- 'setheading':[0],
- 'setpensize':[5],
- 'setscale':[33],
- 'setshade':[50],
- 'settextsize':[32],
- 'setxy':[0,0],
- 'show':[_('text')],
- 'stack':[_('action')],
- 'storeinbox1':[100],
- 'storeinbox2':[100],
- 'storein':[_('my box'),100],
- 'string':[_('text')],
- 'template1x1':[_('Title'), 'None'],
- 'template1x1a':[_('Title'), 'None'],
- 'template1x2':[_('Title'), 'None', 'None'],
- 'template2x1':[_('Title'), 'None', 'None'],
- 'template2x2':[_('Title'), 'None', 'None', 'None', 'None'],
- 'templatelist':[_('Title'), '∙ '],
- 'wait':[1]}
-
-#
-# Blocks that can interchange strings and numbers for their arguments
-#
-STRING_OR_NUMBER_ARGS = ['plus2', 'equal2', 'less2', 'greater2',
- 'template1x1', 'template1x2', 'template2x1',
- 'template2x2', 'template1x1a', 'templatelist', 'nop',
- 'print', 'stack', 'hat']
-
-CONTENT_ARGS = ['show', 'push', 'storein', 'storeinbox1', 'storeinbox2']
-
-#
-# Status blocks
-#
-
-MEDIA_SHAPES = ['audiooff', 'audioon', 'audiosmall',
- 'journaloff', 'journalon', 'journalsmall',
- 'descriptionoff', 'descriptionon', 'descriptionsmall',
- 'pythonoff', 'pythonon', 'pythonsmall',
- 'list', '1x1', '1x1a', '2x1', '1x2', '2x2']
-
-OVERLAY_SHAPES = ['Cartesian', 'polar']
-
-STATUS_SHAPES = ['status', 'info', 'nostack', 'noinput', 'emptyheap',
- 'emptybox', 'nomedia', 'nocode', 'overflowerror',
- 'syntaxerror']
-
-#
-# Legacy names
-#
-OLD_NAMES = {'product':'product2', 'storeinbox':'storein',
- 'division':'division2', 'plus':'plus2', 'and':'and2', 'or':'or2',
- 'less':'less2', 'greater':'greater2', 'equal':'equal2',
- 'remainder':'remainder2', 'identity':'identity2',
- 'division':'division2', 'if else':'if', 'audiooff':'audio',
- 'descriptionoff':'description','template3':'templatelist',
- 'template1':'template1x1', 'template2':'template2x1',
- 'template6':'template1x2', 'template7':'template2x2',
- 'template4':'template1x1a', 'hres':'width', 'vres':'height' }
-
-#
-# Define the relative size and postion of media objects
-# (w, h, x, y, dx, dy)
-#
-TEMPLATES = {'t1x1': (0.5, 0.5, 0.0625, 0.125, 1.05, 0),
- 't2z1': (0.5, 0.5, 0.0625, 0.125, 1.05, 1.05),
- 't1x2': (0.45, 0.45, 0.0625, 0.125, 1.05, 1.05),
- 't2x2': (0.45, 0.45, 0.0625, 0.125, 1.05, 1.05),
- 't1x1a': (0.9, 0.9, 0.0625, 0.125, 0, 0),
- 'bullet': (1, 1, 0.0625, 0.125, 0, 0.1),
- 'insertimage': (0.333, 0.333)}
-
-#
-# Names for blocks without names for popup help
-#
-SPECIAL_NAMES = {
- 'audio':_('audio'),
- 'division2':_('divide'),
- 'equal2':_('equal'),
- 'greater2':_('greater than'),
- 'hspace':_('horizontal space'),
- 'identity2':_('identity'),
- 'if':_('if then'),
- 'ifelse':_('if then else'),
- 'journal':_('journal'),
- 'less2':_('less than'),
- 'minus2':_('minus'),
- 'myfunc':_('Python code'),
- 'nop':_('Python code'),
- 'number':_('number'),
- 'plus2':_('plus'),
- 'product2':_('multiply'),
- 'sqrt':_('square root'),
- 'template1x1':_('presentation 1x1'),
- 'template1x1a':_('presentation 1x1'),
- 'template1x2':_('presentation 1x2'),
- 'template2x1':_('presentation 2x1'),
- 'template2x2':_('presentation 2x2'),
- 'templatelist':_('presentation bulleted list'),
- 'textsize':_('text size'),
- 'vspace':_('vertical space')}
-
-#
-# Help messages
-#
-HELP_STRINGS = {
- 'addturtle':_("choose which turtle to command"),
- 'and2':_("logical AND operator"),
- 'arc':_("move turtle along an arc"),
- 'audio':_("Sugar Journal audio object"),
- 'back':_("move turtle backward"),
- 'blocks':_("palette of variable blocks"),
- 'bottompos':_("ycor of bottom of screen"),
- 'box1':_("variable 1 (numeric value)"),
- 'box2':_("variable 2 (numeric value)"),
- 'box':_("named variable (numeric value)"),
- 'clean':_("clear the screen and reset the turtle"),
- 'clearheap':_("empty FILO"),
- 'color':_("holds current pen color (can be used in place of a number block)"),
- 'colors':_("a palette of pen colors"),
- 'description':_("Sugar Journal description field"),
- 'division2':_("divides top numeric input (numerator) by bottom numeric input (denominator)"),
- 'equal2':_("logical equal-to operator"),
- 'extras':_("palette of extra options"),
- 'fillscreen':_("fills the background with (color, shade)"),
- 'flow':_("palette of flow operators"),
- 'forever':_("loop forever"),
- 'forward':_("move turtle forward"),
- 'greater2':_("logical greater-than operator"),
- 'hat1':_("top of action 1 stack"),
- 'hat2':_("top of action 2 stack"),
- 'hat':_("top of nameable action stack"),
- 'heading':_("holds current heading value of the turtle (can be used in place of a number block)"),
- 'hideblocks':_("declutter canvas by hiding blocks"),
- 'width':_("the canvas width"),
- 'hspace':_("jog stack right"),
- 'identity2':_("identity operator used for extending blocks"),
- 'ifelse':_("if-then-else operator that uses boolean operators from Numbers palette"),
- 'if':_("if-then operator that uses boolean operators from Numbers palette"),
- 'journal':_("Sugar Journal media object"),
- 'kbinput':_("query for keyboard input (results stored in keyboard block)"),
- 'keyboard':_("holds results of query-keyboard block"),
- 'leftpos':_("xcor of left of screen"),
- 'left':_("turn turtle counterclockwise (angle in degrees)"),
- 'less2':_("logical less-than operator"),
- 'minus2':_("subtracts bottom numeric input from top numeric input"),
- 'myfunc':_("a programmable block: add your own math equation in the block, e.g., sin(x)"),
- 'nop':_("runs code found in the tamyblock.py module found in the Journal"),
- 'not':_("logical NOT operator"),
- 'numbers':_("palette of numeric operators"),
- 'number':_("used as numeric input in mathematic operators"),
- 'or':_("logical OR operator"),
- 'orientation':_("changes the orientation of the palette of blocks"),
- 'pendown':_("turtle will draw when moved"),
- 'pen':_("palette of pen commands"),
- 'pensize':_("holds current pen size (can be used in place of a number block)"),
- 'penup':_("turtle will not draw when moved"),
- 'plus2':_("adds two numeric inputs"),
- 'pop':_("pop value off FILO"),
- 'portfolio':_("palette of presentation templates"),
- 'print':_("prints value in status block at bottom of the screen"),
- 'printheap':_("show FILO in status block"),
- 'product2':_("multiplies two numeric inputs"),
- 'push':_("push value onto FILO (first-in last-out) heap"),
- 'random':_("returns random number between minimum (left) and maximum (right) values"),
- 'remainder2':_("modular (remainder) operator"),
- 'repeat':_("loop specified number of times"),
- 'restore':_("restore blocks from trash"),
- 'rightpos':_("xcor of right of screen"),
- 'right':_("turn turtle clockwise (angle in degrees)"),
- 'scale':_("holds current scale value (can be used in place of a number block)"),
- 'setcolor':_("set color of the line drawn by the turtle"),
- 'seth':_("set the heading of the turtle (0 is towards the top of the screen.)"),
- 'setpensize':_("set size of the line drawn by the turtle"),
- 'setscale':_("set the scale of media"),
- 'setshade':_("set shade of the line drawn by the turtle"),
- 'settextcolor':_("set color of text drawn by the turtle"),
- 'settextsize':_("set size of text drawn by turtle"),
- 'setxy':_("move turtle to position xcor, ycor; (0, 0) is in the center of the screen."),
- 'shade':_("holds current pen shade (can be used in place of a number block)"),
- 'show':_("draw text or show media from the Journal"),
- 'showblocks':_("restores hidden blocks"),
- 'sqrt':_("calculate square root"),
- 'stack1':_("invoke action 1 stack"),
- 'stack2':_("invoke action 2 stack"),
- 'stack':_("invoke named action stack"),
- 'start':_("connects action to toolbar run buttons"),
- 'stopstack':_("do not continue current action"),
- 'storeinbox1':_("store numeric value in variable 1"),
- 'storeinbox2':_("store numeric value in variable 2"),
- 'storein':_("store numeric value in named variable"),
- 'string':_("string value"),
- 'template1x1':_("presentation template: select Journal object (with description)"),
- 'template1x1a':_("presentation template: select Journal object (no description)"),
- 'template1x2':_("presentation template: select two Journal objects"),
- 'template2x1':_("presentation template: select two Journal objects"),
- 'template2x2':_("presentation template: select four Journal objects"),
- 'templatelist':_("presentation template: list of bullets"),
- 'textcolor':_("holds current text color (can be used in place of a number block)"),
- 'textsize':_("holds current text size (can be used in place of a number block)"),
- 'toppos':_("ycor of top of screen"),
- 'trash':_("a place to throw away blocks"),
- 'turtle':_("palette of turtle commands"),
- 'height':_("the canvas height"),
- 'vspace':_("jog stack down"),
- 'wait':_("wait specified number of seconds"),
- 'xcor':_("holds current x-coordinate value of the turtle (can be used in place of a number block)"),
- 'ycor':_("holds current y-coordinate value of the turtle (can be used in place of a number block)")}
-
-
-#
-# 'dead key' Unicode dictionaries
-#
-
-DEAD_KEYS = ['grave','acute','circumflex','tilde','diaeresis','abovering']
-DEAD_DICTS = [{'A':192,'E':200,'I':204,'O':210,'U':217,'a':224,'e':232,'i':236,
- 'o':242,'u':249},
- {'A':193,'E':201,'I':205,'O':211,'U':218,'a':225,'e':233,'i':237,
- 'o':243,'u':250},
- {'A':194,'E':202,'I':206,'O':212,'U':219,'a':226,'e':234,
- 'i':238,'o':244,'u':251},
- {'A':195,'O':211,'N':209,'U':360,'a':227,'o':245,'n':241,'u':361},
- {'A':196,'E':203,'I':207,'O':211,'U':218,'a':228,'e':235,
- 'i':239,'o':245,'u':252},
- {'A':197,'a':229}]
-NOISE_KEYS = ['Shift_L', 'Shift_R', 'Control_L', 'Caps_Lock', 'Pause',
- 'Alt_L', 'Alt_R', 'KP_Enter', 'ISO_Level3_Shift', 'KP_Divide',
- 'Escape', 'Return', 'KP_Page_Up', 'Up', 'Down', 'Menu',
- 'Left', 'Right', 'KP_Home', 'KP_End', 'KP_Up', 'Super_L',
- 'KP_Down', 'KP_Left', 'KP_Right', 'KP_Page_Down', 'Scroll_Lock',
- 'Page_Down', 'Page_Up']
-WHITE_SPACE = ['space','Tab']
-
-CURSOR = '█'
diff --git a/samples/csquiral.ta b/samples/csquiral.ta
index bd11427..289e0b0 100644
--- a/samples/csquiral.ta
+++ b/samples/csquiral.ta
@@ -1 +1 @@
-[[0, "start", 215, 24, [null, 1]], [1, "clean", 227, 74, [0, 2]], [2, "storeinbox1", 227, 113, [1, 3, 4]], [3, ["number", "1"], 301, 130, [2, null]], [4, "setpensize", 227, 167, [2, 5, 6]], [5, ["number", "20"], 301, 184, [4, null]], [6, "repeat", 227, 221, [4, 7, 8, null]], [7, ["number", "1300"], 313, 230, [6, null]], [8, "wait", 322, 270, [6, 9, 10]], [9, ["number", "0.1"], 396, 279, [8, null]], [10, "forward", 322, 309, [8, 11, 12]], [11, "box1", 396, 318, [10, null]], [12, "right", 322, 348, [10, 13, 14]], [13, ["number", "91"], 396, 357, [12, null]], [14, "setcolor", 322, 387, [12, 15, 18]], [15, "division2", 396, 380, [14, 16, 17]], [16, "xcor", 436, 388, [15, null]], [17, ["number", "6"], 455, 421, [15, null]], [18, "setshade", 322, 441, [14, 19, 20]], [19, "heading", 396, 458, [18, null]], [20, "storeinbox1", 322, 495, [18, 21, null]], [21, "plus2", 396, 488, [20, 22, 23]], [22, "box1", 436, 496, [21, null]], [23, ["number", "1"], 436, 529, [21, null]], [-1, "turtle", -324.93992977292589, 553.15991039106382, 105.0, -54.156654962154313, 105.0, 20.0]] \ No newline at end of file
+[[0, "start", 241, 263, [null, 1]], [1, "clean", 241, 305, [0, 2]], [2, "storeinbox1", 241, 339, [1, 3, 4]], [3, ["number", 1], 425, 339, [2, null]], [4, "setpensize", 241, 381, [2, 5, 6]], [5, ["number", 20], 393, 381, [4, null]], [6, "repeat", 241, 423, [4, 7, 8, null]], [7, ["number", 1300], 311, 423, [6, null]], [8, "forward", 325, 499, [6, 9, 10]], [9, "box1", 415, 499, [8, null]], [10, "right", 325, 541, [8, 11, 12]], [11, ["number", 91], 383, 541, [10, null]], [12, "setcolor", 325, 583, [10, 22, 16]], [13, "division2", 561, 583, [22, 14, 15]], [14, "xcor", 615, 583, [13, null]], [15, ["number", 6], 639, 629, [13, null]], [16, "setshade", 325, 625, [12, 17, 18]], [17, "heading", 443, 625, [16, null]], [18, "storeinbox1", 325, 667, [16, 19, null]], [19, "plus2", 509, 667, [18, 20, 21]], [20, "box1", 563, 667, [19, null]], [21, ["number", 1], 563, 709, [19, null]], [22, ["identity2", 40], 427, 583, [12, 13]], [-1, ["turtle", 1], -324, 553, 105.0, -54.156654962154313, 105.0, 20.0]] \ No newline at end of file
diff --git a/samples/curlygates.ta b/samples/curlygates.ta
index 7908cde..3859ca8 100644
--- a/samples/curlygates.ta
+++ b/samples/curlygates.ta
@@ -1 +1 @@
-[[0, "start", 199, 22, [null, 1]], [1, "fillscreen", 211, 72, [0, 2, 3, 4]], [2, ["number", "50"], 285, 81, [1, null]], [3, ["number", "30"], 285, 118, [1, null]], [4, "repeat", 211, 148, [1, 5, 6, null]], [5, ["number", "20"], 297, 157, [4, null]], [6, "setxy", 306, 197, [4, 7, 10, 13]], [7, "random", 380, 187, [6, 8, 9, null]], [8, ["number", "-570"], 408, 206, [7, null]], [9, ["number", "570"], 530, 206, [7, null]], [10, "random", 380, 224, [6, 11, 12, null]], [11, ["number", "-440"], 408, 243, [10, null]], [12, ["number", "440"], 530, 243, [10, null]], [13, "seth", 306, 273, [6, 14, 17]], [14, "random", 380, 263, [13, 15, 16, null]], [15, ["number", "0"], 408, 282, [14, null]], [16, ["number", "360"], 530, 282, [14, null]], [17, "stack2", 306, 312, [13, null]], [18, "hat2", 666, 170, [null, 19]], [19, "setcolor", 678, 220, [18, 20, 21]], [20, ["number", "20"], 752, 237, [19, null]], [21, "setshade", 678, 274, [19, 22, 23]], [22, ["number", "60"], 752, 291, [21, null]], [23, "setpensize", 678, 328, [21, 24, 25]], [24, ["number", "20"], 752, 345, [23, null]], [25, "stack1", 678, 382, [23, 26]], [26, "setcolor", 678, 421, [25, 27, 28]], [27, ["number", "0"], 752, 438, [26, null]], [28, "setshade", 678, 475, [26, 29, 32]], [29, "random", 752, 473, [28, 30, 31, null]], [30, ["number", "60"], 780, 492, [29, null]], [31, ["number", "80"], 902, 492, [29, null]], [32, "setpensize", 678, 529, [28, 33, 34]], [33, ["number", "12"], 752, 546, [32, null]], [34, "stack1", 678, 583, [32, null]], [35, "hat1", 195, 317, [null, 36]], [36, "repeat", 207, 367, [35, 37, 38, null]], [37, ["number", "3"], 293, 376, [36, null]], [38, "storeinbox1", 302, 416, [36, 39, 40]], [39, ["number", "200"], 376, 433, [38, null]], [40, "repeat", 302, 470, [38, 41, 42, null]], [41, ["number", "20"], 388, 479, [40, null]], [42, "arc", 397, 519, [40, 43, 44, 45]], [43, ["number", "30"], 471, 528, [42, null]], [44, "box1", 471, 565, [42, null]], [45, "storeinbox1", 397, 595, [42, 46, null]], [46, "division2", 471, 588, [45, 47, 48]], [47, "box1", 511, 596, [46, null]], [48, ["number", "1.2"], 530, 629, [46, null]], [-1, "turtle", 498.00000000000017, -255.00000000000003, 322.0, 0.0, 61, 12.0]] \ No newline at end of file
+[[0, "start", 202, 164, [null, 1]], [1, "fillscreen", 202, 206, [0, 2, 3, 4]], [2, ["number", 50], 284, 206, [1, null]], [3, ["number", 30], 284, 248, [1, null]], [4, "repeat", 202, 290, [1, 5, 6, null]], [5, ["number", 20], 253, 290, [4, null]], [6, "setxy", 267, 350, [4, 46, 8, 45]], [7, "random", 539, 350, [46, 47, 48, null]], [8, "random", 325, 392, [6, 49, 50, null]], [9, "seth", 267, 468, [45, 10, 29]], [10, "random", 366, 468, [9, 11, 12, null]], [11, ["number", 0], 452, 468, [10, null]], [12, ["number", 360], 452, 510, [10, null]], [13, "stack2", 776, 347, [17, 27]], [14, "hat2", 161, 520, [null, 31]], [15, "setcolor", 776, 263, [19, 16, 17]], [16, ["number", 20], 853, 263, [15, null]], [17, "setshade", 776, 305, [15, 18, 13]], [18, ["number", 60], 861, 305, [17, null]], [19, "setpensize", 776, 221, [30, 20, 15]], [20, ["number", 20], 878, 221, [19, null]], [21, "setcolor", 776, 423, [27, 22, 23]], [22, ["number", 0], 853, 423, [21, null]], [23, "setshade", 776, 465, [21, 24, 44]], [24, "random", 861, 465, [23, 25, 26, null]], [25, ["number", 60], 947, 465, [24, null]], [26, ["number", 80], 947, 507, [24, null]], [27, "setpensize", 776, 381, [13, 28, 21]], [28, ["number", 12], 878, 381, [27, null]], [29, "stack1", 267, 510, [9, null]], [30, "hat1", 776, 179, [null, 19]], [31, "repeat", 161, 562, [14, 32, 33, null]], [32, ["number", 3], 212, 562, [31, null]], [33, "storeinbox1", 226, 622, [31, 34, 35]], [34, ["number", 200], 344, 622, [33, null]], [35, "repeat", 226, 664, [33, 36, 37, null]], [36, ["number", 20], 277, 664, [35, null]], [37, "arc", 291, 724, [35, 38, 39, 40]], [38, ["number", 30], 349, 724, [37, null]], [39, "box1", 349, 766, [37, null]], [40, "storeinbox1", 291, 808, [37, 41, null]], [41, "division2", 409, 808, [40, 42, 43]], [42, "box1", 463, 808, [41, null]], [43, ["number", "1.2"], 487, 854, [41, null]], [44, "stack2", 776, 507, [23, null]], [45, ["vspace", 0], 267, 434, [6, 9]], [46, ["identity2", 80], 325, 350, [6, 7]], [47, "leftpos", 625, 350, [7, null]], [48, "rightpos", 625, 392, [7, null]], [49, "bottompos", 411, 392, [8, null]], [50, "toppos", 411, 434, [8, null]], [-1, ["turtle", 1], 764, -268, 189.0, 0.0, 65, 12.0]] \ No newline at end of file