diff options
author | Walter Bender <walter@sugarlabs.org> | 2014-03-15 12:18:01 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2014-03-15 12:18:01 (GMT) |
commit | 68f937b9bf53520494c7fc70634ce0876c03b8fc (patch) | |
tree | 06773e97223369d91e8bd50b4304c8cb6cac2997 | |
parent | cccc7dd5864df674936a8167c236ef765e15b7ed (diff) |
finally? fix block scaling problem
-rw-r--r-- | TurtleArt/tablock.py | 2 | ||||
-rw-r--r-- | TurtleArt/tawindow.py | 27 |
2 files changed, 20 insertions, 9 deletions
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index c257a14..6617ba1 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -185,7 +185,7 @@ class Block: trash -- block in the trash """ def __init__(self, block_list, sprite_list, name, x, y, type='block', - values=None, scale=BLOCK_SCALE[0], + values=None, scale=BLOCK_SCALE[3], colors=['#A0A0A0', '#808080']): self.block_list = block_list diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index dcb5fa5..15eae4b 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -2045,10 +2045,14 @@ class TurtleArtWindow(): if defaults is None: defaults = default_values[name] newblk = Block(self.block_list, self.sprite_list, name, x_pos, - y_pos, 'block', defaults, self.block_scale) + y_pos, 'block', defaults, BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + newblk.rescale(self.block_scale) else: newblk = Block(self.block_list, self.sprite_list, name, x_pos, - y_pos, 'block', [], self.block_scale) + y_pos, 'block', [], BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + newblk.rescale(self.block_scale) # Add a 'skin' to some blocks if name in PYTHON_SKIN: @@ -2095,11 +2099,15 @@ class TurtleArtWindow(): if argname in content_blocks: argblk = Block(self.block_list, self.sprite_list, argname, 0, 0, 'block', [argvalue], - self.block_scale) + BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + argblk.rescale(self.block_scale) else: argblk = Block(self.block_list, self.sprite_list, argname, 0, 0, 'block', [], - self.block_scale) + BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + argblk.rescale(self.block_scale) argdock = argblk.docks[0] nx = sx + dock[2] - argdock[2] ny = sy + dock[3] - argdock[3] @@ -2815,7 +2823,9 @@ class TurtleArtWindow(): argvalue = default_values[blk.name][ len(default_values[blk.name]) - 1] argblk = Block(self.block_list, self.sprite_list, argname, - 0, 0, 'block', [argvalue], self.block_scale) + 0, 0, 'block', [argvalue], BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + argblk.rescale(self.block_scale) argdock = argblk.docks[0] (bx, by) = blk.spr.get_xy() nx = bx + blk.docks[n - 1][2] - argdock[2] @@ -3918,9 +3928,10 @@ class TurtleArtWindow(): btype = OLD_NAMES[btype] blk = Block(self.block_list, self.sprite_list, btype, - b[2] + offset, - b[3] + offset, - 'block', values, self.block_scale) + b[2] + offset, b[3] + offset, + 'block', values, BLOCK_SCALE[3]) + if self.block_scale != BLOCK_SCALE[3]: + blk.rescale(self.block_scale) # If it was an unknown block type, we need to match the number # of dock items. TODO: Try to infer the dock type from connections |