From 7066607c3be33d0a7042b61b2f9afe961f19dc65 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 07 Jul 2012 16:15:22 +0000 Subject: dynamically define EXPANDABLE_FLOW blocks in add_block --- diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index f5af623..8cba7c2 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -90,9 +90,8 @@ EXPANDABLE_STYLE = ['boolean-style', 'compare-porch-style', 'compare-style', 'number-style-porch', 'number-style', 'basic-style-2arg', 'number-style-block', 'box-style-media'] -# Fixme: this should be based on styles -EXPANDABLE_FLOW = ['repeat', 'until', 'while', 'if', 'forever', 'ifelse', - 'sandwichclamp'] +# These are defined in add_block based on block style +EXPANDABLE_FLOW = [] EXPANDABLE = ['vspace', 'hspace', 'identity2'] diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py index dd5ca3f..b14c207 100644 --- a/TurtleArt/tapalette.py +++ b/TurtleArt/tapalette.py @@ -80,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 @@ -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 -- cgit v0.9.1