From f3f81ec511d524750bc2875b45d474e05a616d3e Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 04 Feb 2012 17:35:55 +0000 Subject: using visibility mechanism for hidden blocks --- (limited to 'TurtleArt/tapalette.py') diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py index 61fcb14..2b70670 100644 --- a/TurtleArt/tapalette.py +++ b/TurtleArt/tapalette.py @@ -31,6 +31,7 @@ logo_functions = {} special_names = {} # Names for blocks without names for popup help content_blocks = ['number', 'string', 'description', 'audio', 'video', 'journal'] +hidden_proto_blocks = [] # proto blocks that are (at least initially) hidden value_blocks = [] # blocks whose labels are updated get added here special_block_colors = {} block_styles = {'basic-style': [], @@ -155,8 +156,9 @@ class Palette(): block.set_colors(colors) block.set_value_block(value_block) block.set_content_block(content_block) - if not hidden: - block.set_palette(self._name) + block.set_palette(self._name) + if hidden: + block.set_hidden() block.add_block() @@ -179,10 +181,12 @@ def palette_name_to_index(palette_name): else: return None + def define_logo_function(key, value): ''' Add a logo function to the table. ''' logo_functions[key] = value + class Block(): """ a class for defining new block primitives """ @@ -253,6 +257,9 @@ class Block(): if self._colors is not None: special_block_colors[self._name] = self._colors + def set_hidden(self): + hidden_proto_blocks.append(self._name) + def set_colors(self, colors=None): self._colors = colors -- cgit v0.9.1