Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tawindow.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-01-31 04:31:08 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-01-31 04:31:08 (GMT)
commit09e928cfc71b33c7cec06d88dfa3e5fb3836db12 (patch)
tree568b0dc657d20a7b00105727d13cac4b4c415556 /tawindow.py
parent840418d256e37736aba2c58ad49d936d7eddac73 (diff)
added collapse to expandable blocks
Diffstat (limited to 'tawindow.py')
-rw-r--r--tawindow.py33
1 files changed, 21 insertions, 12 deletions
diff --git a/tawindow.py b/tawindow.py
index 87df608..caecda9 100644
--- a/tawindow.py
+++ b/tawindow.py
@@ -380,8 +380,10 @@ class TurtleArtWindow():
if self.palettes[n] == []:
_min_width = (len(PALETTES)+1)*(SELECTOR_WIDTH)
for i, name in enumerate(PALETTES[n]):
- if name in PORTFOLIO_STYLE:
+ if name in PORTFOLIO_STYLE or name in PORTFOLIO_STYLE_2PIX:
scale = 1.0
+ elif name in BULLET_STYLE:
+ scale = 0.67
else:
scale = 1.5
self.palettes[n].append(Block(self.block_list,
@@ -465,6 +467,8 @@ class TurtleArtWindow():
Find the connected group of block in a stack.
"""
def _find_group(self, blk):
+ if blk is None:
+ return []
group=[blk]
for blk2 in blk.connections[1:]:
if blk2 is not None:
@@ -788,11 +792,6 @@ class TurtleArtWindow():
mov_dict[keyname][1])
elif tur is not None:
self._jog_turtle(mov_dict[keyname][0], mov_dict[keyname][1])
- """
- elif self.selected_spr.type == 'selector':
- if keyname == 'Return' or keyname == 'KP_Page_Up':
- self._select_category(self.selected_spr)
- """
return True
"""
@@ -956,12 +955,12 @@ class TurtleArtWindow():
# Find the block we clicked on and process it.
if self.block_operation=='click':
- self._click_block()
+ self._click_block(x, y)
"""
click block
"""
- def _click_block(self):
+ def _click_block(self, x, y):
blk = self.block_list.spr_to_block(self.selected_spr)
if blk is None:
return
@@ -973,15 +972,25 @@ class TurtleArtWindow():
self._import_from_journal(self.selected_blk)
elif blk.name=='vspace':
group = self._find_group(blk)
+ r,g,b,a = blk.spr.get_pixel((x, y))
+ if (r == 255 and g == 0) or g == 255:
+ dy = blk.reset_y()
+ else:
+ dy = 20
+ blk.expand_in_y(dy)
for b in group:
if b != blk:
- b.spr.move_relative((0, 20*blk.scale))
- blk.expand_in_y(20)
+ b.spr.move_relative((0, dy*blk.scale))
elif blk.name=='hspace':
group = self._find_group(blk.connections[1])
+ r,g,b,a = blk.spr.get_pixel((x, y))
+ if (r == 255 and g == 0) or g == 255:
+ dx = blk.reset_x()
+ else:
+ dx = 20
+ blk.expand_in_x(dx)
for b in group:
- b.spr.move_relative((20*blk.scale, 0))
- blk.expand_in_x(20)
+ b.spr.move_relative((dx*blk.scale, 0))
elif blk.name=='nop' and self.myblock==None:
self._import_py()
else: