diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-07-07 16:15:22 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-07-07 16:15:22 (GMT) |
commit | 7066607c3be33d0a7042b61b2f9afe961f19dc65 (patch) | |
tree | 317a4d1585e83afe1433a7c6f301a3112c09c30a | |
parent | 921f824418e48c6a4d7aa10f10e092df79b1ed4f (diff) |
dynamically define EXPANDABLE_FLOW blocks in add_blockv149
-rw-r--r-- | TurtleArt/taconstants.py | 5 | ||||
-rw-r--r-- | TurtleArt/tapalette.py | 8 |
2 files changed, 9 insertions, 4 deletions
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 |