Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-11-23 16:14:04 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-11-23 16:14:04 (GMT)
commit17e51b8e9cec72732bb49a776a88d830c92a874b (patch)
treebff759974ed79ea51e26dd4d787a2f4c60b8229c
parent2b3c3d11ecf82858d97c8498535c89d8138a59cc (diff)
make bottom of collapsed stack invisible
-rw-r--r--TurtleArt/taconstants.py7
-rw-r--r--TurtleArt/tautils.py18
-rw-r--r--TurtleArt/tawindow.py16
3 files changed, 25 insertions, 16 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index d44e6bb..3aaf97b 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -205,8 +205,9 @@ BASIC_STYLE_TAIL = ['stopstack', 'empty']
BASIC_STYLE = []
BASIC_STYLE_EXTENDED_VERTICAL = ['clean', 'penup', 'pendown', 'stack1',
'stack2', 'hideblocks', 'showblocks', 'clearheap', 'printheap', 'kbinput',
- 'fullscreen', 'sandwichcollapsed', 'cartesian', 'polar', 'startfill',
+ 'fullscreen', 'cartesian', 'polar', 'startfill',
'stopfill', 'readpixel', 'vspace']
+INVISIBLE = ['sandwichcollapsed']
BASIC_STYLE_EXTENDED = ['picturelist', 'picture1x1', 'picture2x2',
'picture2x1', 'picture1x2', 'picture1x1a']
BASIC_STYLE_1ARG = ['forward', 'back', 'left', 'right', 'seth', 'show', 'image',
@@ -398,11 +399,11 @@ BLOCK_NAMES = {
'savepix': [_('save picture')],
'savesvg': [_('save SVG')],
'sandwichbottom': [' ', ' '],
- 'sandwichcollapsed': [' ', _('click to open')],
+ 'sandwichcollapsed': [' '],
'sandwichtop': [_('top of stack')],
'sandwichtop_no_label': [' '],
'sandwichtop_no_arm': [_('top of stack')],
- 'sandwichtop_no_arm_no_label': [' '],
+ 'sandwichtop_no_arm_no_label': [' ', _('click to open')],
'scale': [_('scale')],
'see': [_('turtle sees')],
'sensor': [_('sensors')],
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 960b442..5fbcdb9 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -464,6 +464,8 @@ def restore_stack(top):
top.name = 'sandwichtop'
else:
top.name = 'sandwichtop_no_label'
+ top.spr.set_label(' ', 1)
+ top.resize()
top.refresh()
grow_stack_arm(top)
@@ -513,7 +515,7 @@ def collapse_stack(top):
for _blk in _group:
if not _hit_bottom and _blk == _bot:
_hit_bottom = True
- # Replace 'sandwichbottom' shape with 'sandwichcollapsed' shape
+ # Replace 'sandwichbottom' with invisible 'sandwichcollapsed'
if len(_blk.values) == 0:
_blk.values.append(1)
else:
@@ -521,16 +523,7 @@ def collapse_stack(top):
_olddx = _blk.docks[1][2]
_olddy = _blk.docks[1][3]
_blk.name = 'sandwichcollapsed'
- _blk.svg.set_show(True)
- _blk.svg.set_hide(False)
- _blk._dx = 0
- _blk._ey = 0
- _blk.spr.set_label(' ')
- _blk.spr.set_label(' ', 1)
- _blk.resize()
- _blk.spr.set_label(_('click to open'), 1)
_blk.resize()
- # Redock to sandwich top in group
_you = find_sandwich_top(_blk)
(_yx, _yy) = _you.spr.get_xy()
_yd = _you.docks[len(_you.docks) - 1]
@@ -554,6 +547,11 @@ def collapse_stack(top):
top.name = 'sandwichtop_no_arm'
else:
top.name = 'sandwichtop_no_arm_no_label'
+ top.spr.set_label(' ')
+ top.spr.set_label(' ', 1)
+ top.resize()
+ top.spr.set_label(_('click to open'), 1)
+ top.resize()
top.refresh()
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 0efdc88..7b59043 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -828,7 +828,6 @@ class TurtleArtWindow():
elif blk.name in MACROS:
self._new_macro(blk.name, x + 20, y + 20)
else:
- # TODO: put up an alert message
# You can only have one instance of some blocks
if blk.name in ['start', 'hat1', 'hat2']:
if len(self.block_list.get_similar_blocks(
@@ -908,7 +907,7 @@ class TurtleArtWindow():
return True
def _select_category(self, spr):
- """ Select a category from the toolbar (old Sugar systems only). """
+ """ Select a category from the toolbar """
i = self.selectors.index(spr)
spr.set_shape(self.selector_shapes[i][1])
if self.selected_selector is not None:
@@ -1489,13 +1488,16 @@ class TurtleArtWindow():
if blk is None:
return
self.selected_blk = blk
+
if blk.name == 'number' or blk.name == 'string':
self.saved_string = blk.spr.labels[0]
blk.spr.labels[0] += CURSOR
+
elif blk.name in BOX_STYLE_MEDIA:
self._import_from_journal(self.selected_blk)
if blk.name == 'journal' and self.running_sugar:
self._load_description_block(blk)
+
elif blk.name == 'identity2' or blk.name == 'hspace':
group = find_group(blk)
if hide_button_hit(blk.spr, x, y):
@@ -1508,6 +1510,7 @@ class TurtleArtWindow():
for gblk in group:
if gblk != blk:
gblk.spr.move_relative((dx * blk.scale, 0))
+
elif blk.name == 'vspace':
group = find_group(blk)
if hide_button_hit(blk.spr, x, y):
@@ -1521,6 +1524,7 @@ class TurtleArtWindow():
if gblk != blk:
gblk.spr.move_relative((0, dy * blk.scale))
grow_stack_arm(find_sandwich_top(blk))
+
elif blk.name in EXPANDABLE_BLOCKS:
# Connection may be lost during expansion, so store it...
blk0 = blk.connections[0]
@@ -1598,12 +1602,18 @@ class TurtleArtWindow():
else:
self._start_audiograb()
self._run_stack(blk)
+
+ elif blk.name in ['sandwichtop_no_arm_no_label',
+ 'sandwichtop_no_arm']:
+ restore_stack(blk)
+
elif blk.name in COLLAPSIBLE:
top = find_sandwich_top(blk)
if collapsed(blk):
- restore_stack(top)
+ restore_stack(top) # depreciated (bottom block is invisible)
elif top is not None:
collapse_stack(top)
+
else:
self._start_audiograb()
self._run_stack(blk)