Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2014-03-15 12:59:28 (GMT)
committer Walter Bender <walter@sugarlabs.org>2014-03-15 12:59:28 (GMT)
commit2065e306ef9bd9597a633f9924b5d0d5997db147 (patch)
tree522fdd3a8056b7711bafa375afb66f111e94d6eb
parenta1bf692338309c4b03068c99e0a68ac19abd6115 (diff)
resync to v200
-rw-r--r--NEWS7
-rw-r--r--TurtleArt/tablock.py4
-rw-r--r--TurtleArt/taconstants.py18
-rw-r--r--TurtleArt/taprimitive.py20
-rw-r--r--TurtleArt/tawindow.py28
-rw-r--r--activity/activity.info2
6 files changed, 58 insertions, 21 deletions
diff --git a/NEWS b/NEWS
index b222018..1adb3be 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+200
+
+BUG FIXES:
+* Fixed regression in python export due to typo
+* Fixed regression in boolean operators due to ColorObj class
+* Fixed block scaling problem
+
199
ENHANCEMENTS:
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py
index ad17ca8..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
@@ -372,7 +372,7 @@ class Block:
if self.spr is None:
return
dx = (self.spr.label_width() - self.spr.label_safe_width()) / \
- self.scale
+ self.scale
if self.dx + dx >= self.block_list.max_width and self.name == 'string':
self.dx = self.block_list.max_width
self.refresh()
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 0a3cc23..469f5d3 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -156,18 +156,28 @@ class ColorObj(object):
self.color = color
def __int__(self):
- if self.color.color is None:
- return int(self.color.shade)
+ if hasattr(self.color, 'color'):
+ if self.color.color is None:
+ return int(self.color.shade)
+ else:
+ return int(self.color.color)
else:
- return int(self.color.color)
+ return int(self.color)
def __float__(self):
- return float(int(self))
+ if hasattr(self.color, 'color'):
+ return float(int(self))
+ else:
+ return float(self.color)
def __str__(self):
+ if isinstance(self.color, (float, int, bool)):
+ return str(self.color)
return str(self.color.name)
def __repr__(self):
+ if isinstance(self.color, (float, int, bool)):
+ return str(self.color)
return str(self.color.name)
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py
index 197a8d8..e840d92 100644
--- a/TurtleArt/taprimitive.py
+++ b/TurtleArt/taprimitive.py
@@ -28,7 +28,7 @@ import traceback
from tablock import Media
from tacanvas import TurtleGraphics
-from taconstants import (Color, CONSTANTS)
+from taconstants import (Color, CONSTANTS, ColorObj)
from talogo import (LogoCode, logoerror, NegativeRootError)
from taturtle import (Turtle, Turtles)
from TurtleArt.tatype import (TYPE_CHAR, TYPE_INT, TYPE_FLOAT, TYPE_OBJECT,
@@ -761,17 +761,29 @@ class Primitive(object):
@staticmethod
def equals(arg1, arg2):
""" Return arg1 == arg2 """
- return arg1 == arg2
+ # See comment in tatype.py TYPE_BOX -> TYPE_COLOR
+ if isinstance(arg1, ColorObj) or isinstance(arg2, ColorObj):
+ return str(arg1) == str(arg2)
+ else:
+ return arg1 == arg2
@staticmethod
def less(arg1, arg2):
""" Return arg1 < arg2 """
- return arg1 < arg2
+ # See comment in tatype.py TYPE_BOX -> TYPE_COLOR
+ if isinstance(arg1, ColorObj) or isinstance(arg2, ColorObj):
+ return float(arg1) < float(arg2)
+ else:
+ return arg1 < arg2
@staticmethod
def greater(arg1, arg2):
""" Return arg1 > arg2 """
- return arg1 > arg2
+ # See comment in tatype.py TYPE_BOX -> TYPE_COLOR
+ if isinstance(arg1, ColorObj) or isinstance(arg2, ColorObj):
+ return float(arg1) > float(arg2)
+ else:
+ return arg1 > arg2
@staticmethod
def comment(text):
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index dcb5fa5..1d87c9b 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)
+ 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', [])
+ if self.block_scale != BLOCK_SCALE[3]:
+ newblk.rescale(self.block_scale)
# Add a 'skin' to some blocks
if name in PYTHON_SKIN:
@@ -2094,12 +2098,14 @@ class TurtleArtWindow():
if argname is not None:
if argname in content_blocks:
argblk = Block(self.block_list, self.sprite_list,
- argname, 0, 0, 'block', [argvalue],
- self.block_scale)
+ argname, 0, 0, 'block', [argvalue])
+ 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)
+ argname, 0, 0, 'block', [])
+ 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 +2821,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])
+ 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 +3926,9 @@ 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)
+ 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
diff --git a/activity/activity.info b/activity/activity.info
index a080603..2b4fc56 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
name = TurtleBlocks
-activity_version = 199.1
+activity_version = 200.1
license = MIT
bundle_id = org.laptop.TurtleArtActivity
exec = sugar-activity TurtleArtActivity.TurtleArtActivity