Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-11-06 20:39:09 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-11-06 20:39:09 (GMT)
commit1d5319be2aab4d68212a133e2d4946c85618a1e3 (patch)
treeb1e1bead9d4b4468e71e91bc645bf5d62710f6a3
parentbc7af564cdabd19be30cb0bd61528cf1a6bd3df2 (diff)
add warning message for duplicate/incmpatible blocks
-rw-r--r--TurtleArt/taconstants.py8
-rw-r--r--TurtleArt/tawindow.py31
-rw-r--r--images/dupstack.svg98
-rw-r--r--images/incompatible.svg381
4 files changed, 508 insertions, 10 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 49a8dc3..df87da3 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -695,10 +695,10 @@ MEDIA_SHAPES = ['audiooff', 'audioon', 'audiosmall',
OVERLAY_SHAPES = ['Cartesian', 'Cartesian_labeled', 'polar']
-STATUS_SHAPES = ['status', 'info', 'nostack', 'noinput', 'emptyheap',
- 'emptybox', 'nomedia', 'nocode', 'overflowerror', 'negroot',
- 'syntaxerror', 'nofile', 'nojournal', 'zerodivide',
- 'notanumber']
+STATUS_SHAPES = ['status', 'info', 'nostack', 'dupstack', 'noinput',
+ 'emptyheap', 'emptybox', 'nomedia', 'nocode', 'overflowerror',
+ 'negroot', 'syntaxerror', 'nofile', 'nojournal', 'zerodivide',
+ 'notanumber', 'incompatible']
#
# Emulate Sugar toolbar when running from outside of Sugar
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index dfe0828..2402087 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -328,12 +328,8 @@ class TurtleArtWindow():
def _start_audiograb(self):
""" Start grabbing audio if there is an audio block in use """
- if len(self.block_list.get_similar_blocks('block', 'volume')) > 0 or \
- len(self.block_list.get_similar_blocks('block', 'sound')) > 0 or \
- len(self.block_list.get_similar_blocks('block', 'pitch')) > 0 or \
- len(self.block_list.get_similar_blocks('block',
- 'resistance')) > 0 or \
- len(self.block_list.get_similar_blocks('block', 'voltage')) > 0:
+ if len(self.block_list.get_similar_blocks('block',
+ ['volume', 'sound', 'pitch', 'resistance', 'voltage'])) > 0:
if self.audio_started:
self.audiograb.resume_grabbing()
else:
@@ -831,11 +827,34 @@ class TurtleArtWindow():
elif blk.name in MACROS:
self._new_macro(blk.name, x + 20, y + 20)
else:
+ # TODO: put up an alert message
# You can only have one instance of some blocks
if blk.name in ['start', 'hat1', 'hat2']:
if len(self.block_list.get_similar_blocks(
'block', blk.name)) > 0:
+ self.showlabel('dupstack')
return True
+ # You cannot miz and match sensor blocks
+ elif blk.name in ['sound', 'volume', 'pitch']:
+ if len(self.block_list.get_similar_blocks(
+ 'block', ['resistance', 'voltage'])) > 0:
+ self.showlabel('incompatible')
+ return True
+ elif blk.name in ['resistance', 'voltage']:
+ if len(self.block_list.get_similar_blocks(
+ 'block', ['sound', 'volume', 'pitch'])) > 0:
+ self.showlabel('incompatible')
+ return True
+ if blk.name == 'resistance':
+ if len(self.block_list.get_similar_blocks(
+ 'block', 'voltage')) > 0:
+ self.showlabel('incompatible')
+ return True
+ elif blk.name == 'voltage':
+ if len(self.block_list.get_similar_blocks(
+ 'block', 'resistance')) > 0:
+ self.showlabel('incompatible')
+ return True
blk.highlight()
self._new_block(blk.name, x, y)
blk.unhighlight()
diff --git a/images/dupstack.svg b/images/dupstack.svg
new file mode 100644
index 0000000..6a0f3fd
--- /dev/null
+++ b/images/dupstack.svg
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.0"
+ width="767"
+ height="38"
+ id="svg2467">
+ <metadata
+ id="metadata20">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs2493" />
+ <path
+ d="M 15,37.5 C 11.5,37.5 8,35 5.5,32.5 3,30 0.5,26.5 0.5,23 l 0,-8 c 0,-3.25 2.5,-8.5 5,-10.5 2.5,-2 6,-4 9.5,-4 l 736.5,0 c 2.5,0 7,1 10.5,4 3.5,2.75 4.5,7.5 4.5,10.5 l 0,8 c 0,3.5 -2,7 -4.5,9.5 -2.5,2.5 -6.5,5 -10.5,5 L 15,37.5 z"
+ id="path4"
+ style="fill:#ffd000;fill-opacity:1;fill-rule:evenodd;stroke:#e0a000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <g
+ transform="translate(656,65.625)"
+ id="g6">
+ <path
+ d="m 79.5,438.5 c 0,4.5 -3.75,8 -8.5,8 -4.5,0 -8.25,-3.5 -8.25,-8 0,-4.5 3.75,-8.25 8.25,-8.25 4.75,0 8.5,3.75 8.5,8.25 l 0,0 z"
+ transform="translate(24,-485)"
+ id="path8"
+ style="fill:#ff4040;fill-opacity:1;fill-rule:nonzero;stroke:#ff4040;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ id="text10"
+ style="font-size:12px;font-weight:bold;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans">
+ <tspan
+ x="91"
+ y="-42"
+ id="tspan12"
+ style="font-size:12px">X</tspan>
+ </text>
+ </g>
+ <path
+ d="m 222.97818,18.999999 0,0 -26,15.000001 0,0 0,3 -13.50001,0 0,-3 c 0,0 -26,-15.000001 -26,-15.000001 0,0 33.00001,-17.9999992 33.00001,-17.9999992 0,0 32.5,17.9999992 32.5,17.9999992 z"
+ id="path2490-6"
+ style="fill:#ffe000;fill-opacity:1;fill-rule:nonzero;stroke:#c0a000;stroke-width:1.33340001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ x="6.1187973"
+ y="4.1250014"
+ id="text2474"
+ style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans">
+ <tspan
+ x="176.1188"
+ y="32.125"
+ id="tspan2476"
+ style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans">x</tspan>
+ </text>
+ <g
+ transform="translate(6,0)"
+ id="g2478">
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(-4,20)"
+ id="path2480"
+ style="fill:#404040;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(1,17)"
+ id="path2482"
+ style="fill:#e0e0e0;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(-1,18)"
+ id="path2484"
+ style="fill:#ffe000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <text
+ x="6"
+ id="text2486"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans">
+ <tspan
+ x="27"
+ y="29"
+ id="tspan2488"
+ style="font-size:24px">!</tspan>
+ </text>
+ <path
+ d="m 148.5,19 0,0 -26,15 0,0 0,3 -13.5,0 0,-3 c 0,0 -26,-15 -26,-15 0,0 33,-18 33,-18 0,0 32.5,18 32.5,18 z"
+ id="path2490"
+ style="fill:#ffe000;fill-opacity:1;fill-rule:nonzero;stroke:#c0a000;stroke-width:1.33340001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+</svg>
diff --git a/images/incompatible.svg b/images/incompatible.svg
new file mode 100644
index 0000000..433bf4d
--- /dev/null
+++ b/images/incompatible.svg
@@ -0,0 +1,381 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.0"
+ width="767"
+ height="38"
+ id="svg2">
+ <metadata
+ id="metadata73">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs32">
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="64"
+ y2="0"
+ id="linearGradient2540"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(34.404412,58.027574)" />
+ <linearGradient
+ id="linearGradient2504">
+ <stop
+ id="stop2506"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2508"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="64"
+ y2="0"
+ id="linearGradient2510"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,4.96875)" />
+ <linearGradient
+ x1="210"
+ y1="10.5"
+ x2="0"
+ y2="10.5"
+ id="linearGradient2512"
+ xlink:href="#linearGradient3886"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2514">
+ <stop
+ id="stop2516"
+ style="stop-color:#0000ff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2518"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="210"
+ y1="10.5"
+ x2="0"
+ y2="10.5"
+ id="linearGradient2520"
+ xlink:href="#linearGradient3886"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="64"
+ y2="0"
+ id="linearGradient2522"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,4.96875)" />
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="104"
+ y2="21"
+ id="linearGradient2524"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,5.4999997)" />
+ <linearGradient
+ id="linearGradient2492">
+ <stop
+ id="stop2494"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2496"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="104"
+ y2="21"
+ id="linearGradient2493"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2486">
+ <stop
+ id="stop2488"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2490"
+ style="stop-color:#0000ff;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2509">
+ <stop
+ id="stop2511"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2513"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="74"
+ y2="22"
+ id="linearGradient2515"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient2608"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2595">
+ <stop
+ id="stop2597"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2599"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="74"
+ y2="22"
+ id="linearGradient2601"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2473">
+ <stop
+ id="stop2475"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2477"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="64"
+ y2="0"
+ id="linearGradient4238"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,4.96875)" />
+ <linearGradient
+ x1="210"
+ y1="10.5"
+ x2="0"
+ y2="10.5"
+ id="linearGradient4211"
+ xlink:href="#linearGradient3886"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient3886">
+ <stop
+ id="stop3888"
+ style="stop-color:#0000ff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop3890"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="210"
+ y1="10.5"
+ x2="0"
+ y2="10.5"
+ id="linearGradient2496"
+ xlink:href="#linearGradient3886"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="64"
+ y2="0"
+ id="linearGradient2501"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,4.96875)" />
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient3172"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient3166">
+ <stop
+ id="stop3168"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop3170"
+ style="stop-color:#ff0000;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="104"
+ y2="21"
+ id="linearGradient2539"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient2533">
+ <stop
+ id="stop2535"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop2537"
+ style="stop-color:#ffff00;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient2543"
+ xlink:href="#linearGradient3166"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,79.98708,11.125)" />
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient2543-4"
+ xlink:href="#linearGradient3166-4"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,160.75,11.125)" />
+ <linearGradient
+ id="linearGradient3166-4">
+ <stop
+ id="stop3168-3"
+ style="stop-color:#ffffff;stop-opacity:1"
+ offset="0" />
+ <stop
+ id="stop3170-0"
+ style="stop-color:#ff0000;stop-opacity:1"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="22"
+ x2="128.68382"
+ y2="22"
+ id="linearGradient3833"
+ xlink:href="#linearGradient3166-4"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.75,0,0,0.75,207.68104,11.125001)" />
+ </defs>
+ <path
+ d="M 15,37.5 C 11.5,37.5 8,35 5.5,32.5 3,30 0.5,26.5 0.5,23 l 0,-8 c 0,-3.25 2.5,-8.5 5,-10.5 2.5,-2 6,-4 9.5,-4 l 736.5,0 c 2.5,0 7,1 10.5,4 3.5,2.75 4.5,7.5 4.5,10.5 l 0,8 c 0,3.5 -2,7 -4.5,9.5 -2.5,2.5 -6.5,5 -10.5,5 L 15,37.5 z"
+ id="path4"
+ style="fill:#ffd000;fill-opacity:1;fill-rule:evenodd;stroke:#e0a000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <g
+ transform="translate(656,65.625)"
+ id="g6">
+ <path
+ d="m 79.5,438.5 c 0,4.5 -3.75,8 -8.5,8 -4.5,0 -8.25,-3.5 -8.25,-8 0,-4.5 3.75,-8.25 8.25,-8.25 4.75,0 8.5,3.75 8.5,8.25 l 0,0 z"
+ transform="translate(24,-485)"
+ id="path8"
+ style="fill:#ff4040;fill-opacity:1;fill-rule:nonzero;stroke:#ff4040;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <text
+ id="text10"
+ style="font-size:12px;font-weight:bold;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans">
+ <tspan
+ x="91"
+ y="-42"
+ id="tspan12"
+ style="font-size:12px">X</tspan>
+ </text>
+ </g>
+ <g
+ transform="translate(6,0)"
+ id="g17">
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(-4,20)"
+ id="path19"
+ style="fill:#404040;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(1,17)"
+ id="path21"
+ style="fill:#e0e0e0;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="M 44,15 10.5,15 27.5,-14 44,15 z"
+ transform="translate(-1,18)"
+ id="path23"
+ style="fill:#ffe000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <text
+ x="6"
+ id="text25"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans">
+ <tspan
+ x="27"
+ y="29"
+ id="tspan27"
+ style="font-size:24px">!</tspan>
+ </text>
+ <text
+ x="176.34187"
+ y="25.5625"
+ id="text2618"
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"><tspan
+ x="176.34187"
+ y="25.5625"
+ id="tspan2620"
+ style="font-size:24px;fill:#ff0000;fill-opacity:1">x</tspan></text>
+ <path
+ d="m 80.73708,11.5 3.75,0 0,3 5.25,0 0,-3 68.625,0 0,15 -68.625,0 0,-3 -5.25,0 0,3 -3.75,0 0,-15 z"
+ id="path2541"
+ style="fill:url(#linearGradient2543);fill-opacity:1;stroke:#ff0000;stroke-width:2;stroke-opacity:1" />
+ <path
+ d="m 208.43104,11.500001 3.75,0 0,2.999999 5.25,0 0,-2.999999 68.625,0 0,14.999999 -68.625,0 0,-3 -5.25,0 0,3 -3.75,0 0,-14.999999 z"
+ id="path2541-7"
+ style="fill:url(#linearGradient3833);fill-opacity:1;stroke:#ff0000;stroke-width:2;stroke-opacity:1" />
+</svg>