Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
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 /TurtleArt
parentbc7af564cdabd19be30cb0bd61528cf1a6bd3df2 (diff)
add warning message for duplicate/incmpatible blocks
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/taconstants.py8
-rw-r--r--TurtleArt/tawindow.py31
2 files changed, 29 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()