Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/tablock.py8
-rw-r--r--TurtleArt/taconstants.py3
-rwxr-xr-xTurtleArt/tasprite_factory.py16
3 files changed, 20 insertions, 7 deletions
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py
index 05b95ae..3db3e6e 100644
--- a/TurtleArt/tablock.py
+++ b/TurtleArt/tablock.py
@@ -35,7 +35,7 @@ from taconstants import EXPANDABLE, EXPANDABLE_BLOCKS, EXPANDABLE_ARGS, \
COLLAPSIBLE_TOP, COLLAPSIBLE_TOP_NO_ARM, COLLAPSIBLE_TOP_NO_LABEL, \
COLLAPSIBLE_TOP_NO_ARM_NO_LABEL, COLLAPSIBLE_BOTTOM, PORTFOLIO_STYLE_2x2, \
PORTFOLIO_STYLE_1x1, PORTFOLIO_STYLE_2x1, PORTFOLIO_STYLE_1x2, \
- STANDARD_STROKE_WIDTH, BOX_COLORS, GRADIENT_COLOR, \
+ STANDARD_STROKE_WIDTH, BOX_COLORS, GRADIENT_COLOR, COMPARE_PORCH_STYLE, \
BASIC_STYLE_EXTENDED_VERTICAL, CONSTANTS, INVISIBLE
from tasprite_factory import SVG, svg_str_to_pixbuf
import sprites
@@ -443,6 +443,8 @@ class Block:
self._make_number_style_porch(svg)
elif self.name in COMPARE_STYLE:
self._make_compare_style(svg)
+ elif self.name in COMPARE_PORCH_STYLE:
+ self._make_compare_porch_style(svg)
elif self.name in BOOLEAN_STYLE:
self._make_boolean_style(svg)
elif self.name in NOT_STYLE:
@@ -706,6 +708,10 @@ class Block:
self.svg.docks[2][1]],
['unavailable', False, 0, 0, ')']]
+ def _make_compare_porch_style(self, svg):
+ self.svg.set_porch(True)
+ self._make_compare_style(svg)
+
def _make_boolean_style(self, svg):
self.svg.expand(10 + self.dx + self.ex, self.ey)
self._make_block_graphics(svg, self.svg.boolean_and_or)
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index f5d97ad..f383105 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -226,7 +226,8 @@ NUMBER_STYLE_BLOCK = ['random']
NUMBER_STYLE_PORCH = ['minus2', 'division2', 'remainder2']
NUMBER_STYLE_1ARG = ['sqrt', 'identity2']
NUMBER_STYLE_1STRARG = ['box']
-COMPARE_STYLE = ['greater2', 'less2', 'equal2']
+COMPARE_STYLE = ['equal2']
+COMPARE_PORCH_STYLE = ['greater2', 'less2']
BOOLEAN_STYLE = ['and2', 'or2']
NOT_STYLE = ['not']
FLOW_STYLE = ['forever']
diff --git a/TurtleArt/tasprite_factory.py b/TurtleArt/tasprite_factory.py
index fe9166d..3e2f708 100755
--- a/TurtleArt/tasprite_factory.py
+++ b/TurtleArt/tasprite_factory.py
@@ -80,6 +80,15 @@ class SVG:
self._gradient = False
self.margins = [0, 0, 0, 0]
+ """
+ The block construction methods typically start on the left side of
+ a block and proceed clockwise around the block, first constructing a
+ left-side connector ("outie"), a corner (1, -1), a slot or hat on along
+ the top, a corner (1, 1), right side connectors ("innie"), possibly a
+ "porch" to suggest an order of arguments, another corner (-1, 1),
+ a tab or tail, and the fourth corner (-1, -1).
+ """
+
def basic_block(self):
self.reset_min_max()
(x, y) = self._calculate_x_y()
@@ -334,12 +343,8 @@ class SVG:
yoffset = self._radius * 2 + 2 * self._innie_y2 + \
self._innie_spacer + self._stroke_width / 2.0 + \
self._expand_y
- if self._porch is True:
- yoffset += self._porch_y
svg = self._start_boolean(self._stroke_width / 2.0, yoffset)
yoffset = -2 * self._innie_y2 - self._innie_spacer - self._stroke_width
- if self._porch is True:
- yoffset -= self._porch_y
svg += self._rline_to(0, yoffset)
self._hide_x = self._x + self._radius / 2 + self._stroke_width
@@ -353,12 +358,13 @@ class SVG:
svg += self._do_innie()
svg += self._rline_to(0, self._expand_y)
if self._porch is True:
- svg += self._do_porch()
+ svg += self._do_porch(False)
else:
svg += self._rline_to(0, 2 * self._innie_y2 + self._innie_spacer)
svg += self._do_innie()
svg += self._rline_to(0, self._radius)
svg += self.line_to(xx, self._y)
+
svg += self._rline_to(-self._expand_x, 0)
self._show_y = self._y + self._radius / 2