diff options
Diffstat (limited to 'TurtleArt/tapalette.py')
-rw-r--r-- | TurtleArt/tapalette.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py index ad96103..b14c207 100644 --- a/TurtleArt/tapalette.py +++ b/TurtleArt/tapalette.py @@ -22,6 +22,7 @@ help_palettes = {} help_windows = {} palette_names = [] +palette_init_on_start = [] palette_blocks = [] block_colors = [] expandable_blocks = [] @@ -49,7 +50,6 @@ block_styles = {'basic-style': [], 'basic-style-3arg': [], 'basic-style-var-arg': [], 'bullet-style': [], - 'invisible': [], 'box-style': [], 'box-style-media': [], 'number-style': [], @@ -62,17 +62,13 @@ block_styles = {'basic-style': [], 'compare-porch-style': [], 'boolean-style': [], 'not-style': [], - 'flow-style': [], 'flow-style-tail': [], - 'flow-style-1arg': [], - 'flow-style-boolean': [], - 'flow-style-while': [], - 'flow-style-else': [], - 'collapsible-top': [], - 'collapsible-top-no-arm': [], - 'collapsible-top-no-label': [], - 'collapsible-top-no-arm-no-label': [], - 'collapsible-bottom': [], + 'clamp-style': [], + 'clamp-style-collapsible': [], + 'clamp-style-collapsed': [], + 'clamp-style-1arg': [], + 'clamp-style-boolean': [], + 'clamp-style-else': [], 'portfolio-style-2x2': [], 'portfolio-style-1x1': [], 'portfolio-style-2x1': [], @@ -84,7 +80,7 @@ import gtk from sugar.graphics.icon import Icon from sugar.graphics import style -from taconstants import EXPANDABLE_STYLE +from taconstants import EXPANDABLE_STYLE, EXPANDABLE_FLOW from tautils import debug_output from util.helpbutton import add_section, add_paragraph @@ -125,7 +121,7 @@ class Palette(): self._help_box = help_palettes[self._name] self._help = 'deja vu' - def add_palette(self, position=None): + def add_palette(self, position=None, init_on_start=False): if self._name is None: debug_output('You must specify a name for your palette') return @@ -143,6 +139,9 @@ class Palette(): palette_names.insert(i, self._name) palette_blocks.insert(i, []) block_colors.insert(i, self._colors) + if init_on_start: + if not self._name in palette_init_on_start: + palette_init_on_start.append(self._name) else: return @@ -211,7 +210,8 @@ class Palette(): block.add_block() -def make_palette(palette_name, colors=None, help_string=None, position=None): +def make_palette(palette_name, colors=None, help_string=None, position=None, + init_on_start=False): """ Palette helper function """ if colors is None: palette = Palette(palette_name) @@ -219,7 +219,7 @@ def make_palette(palette_name, colors=None, help_string=None, position=None): palette = Palette(palette_name, colors) if help_string is not None: palette.set_help(help_string) - palette.add_palette(position) + palette.add_palette(position, init_on_start=init_on_start) return palette @@ -271,6 +271,12 @@ class Block(): return else: block_styles[self._style].append(self._name) + if self._style in ['clamp-style', + 'clamp-style-collapsible', + 'clamp-style-1arg', + 'clamp-style-boolean', + 'clamp-style-else']: + EXPANDABLE_FLOW.append(self._name) if self._label is not None: block_names[self._name] = self._label |