Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tapalette.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-05-07 12:31:22 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-05-07 12:31:22 (GMT)
commit26e31f351f2b0cda8c0b24741cc93ff8ec542c7d (patch)
tree545651baa1b7336277ce8d85b07a88d07656ff96 /TurtleArt/tapalette.py
parent053526450989541e9c51503aff4b6b83d884085d (diff)
move string_or_number whitelist to taplatte.py
Diffstat (limited to 'TurtleArt/tapalette.py')
-rw-r--r--TurtleArt/tapalette.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py
index 7678f7e..ad96103 100644
--- a/TurtleArt/tapalette.py
+++ b/TurtleArt/tapalette.py
@@ -36,6 +36,7 @@ content_blocks = ['number', 'string', 'description', 'audio', 'video',
hidden_proto_blocks = [] # proto blocks that are (at least initially) hidden
value_blocks = [] # blocks whose labels are updated get added here
special_block_colors = {}
+string_or_number_args = []
block_styles = {'basic-style': [],
'blank-style': [],
'basic-style-head': [],
@@ -164,7 +165,8 @@ class Palette():
def add_block(self, block_name, style='basic-block', label=None,
special_name=None, default=None, prim_name=None,
help_string=None, value_block=False, content_block=False,
- logo_command=None, hidden=False, colors=None):
+ logo_command=None, hidden=False, colors=None,
+ string_or_number=False):
""" Add a new block to the palette """
block = Block(block_name)
block.set_style(style)
@@ -199,6 +201,8 @@ class Palette():
help_string))
if colors is not None:
block.set_colors(colors)
+ if string_or_number:
+ block.set_string_or_number()
block.set_value_block(value_block)
block.set_content_block(content_block)
block.set_palette(self._name)
@@ -250,6 +254,7 @@ class Block():
self._content_block = False
self._colors = None
self._hidden = False
+ self._string_or_number = False
def add_block(self, position=None):
if self._name is None:
@@ -313,6 +318,9 @@ class Block():
if self._colors is not None:
special_block_colors[self._name] = self._colors
+ if self._string_or_number:
+ string_or_number_args.append(self._name)
+
if self._hidden:
hidden_proto_blocks.append(self._name)
@@ -322,6 +330,9 @@ class Block():
def set_colors(self, colors=None):
self._colors = colors
+ def set_string_or_number(self, flag=True):
+ self._string_or_number = flag
+
def set_value_block(self, value=True):
self._value_block = value