Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmoxhay <pmoxhay@earthlink.net>2009-05-26 13:55:11 (GMT)
committer pmoxhay <pmoxhay@earthlink.net>2009-05-26 13:55:11 (GMT)
commitc997369b54a9d0d5e4865e99b17e930bca8a1528 (patch)
tree9f19782a129ed1d8128548b058cd78f70c25b335
parent9f52a7ce71a89ffab1762348741699a34a0c16d2 (diff)
Fixed behavior of lengths when clicked inside answer box.
-rw-r--r--areaproblem.py2
-rw-r--r--compare3lesson.py8
-rw-r--r--lengthproblem.py17
-rw-r--r--shapeobject.py10
4 files changed, 14 insertions, 23 deletions
diff --git a/areaproblem.py b/areaproblem.py
index b17e47a..e3e70f1 100644
--- a/areaproblem.py
+++ b/areaproblem.py
@@ -123,7 +123,7 @@ class AreaProblem(Problem):
problem_number = random.randrange(0,n_problems)
# Uncomment to test a particular problem.
- #problem_number = 2
+ #problem_number = 0
# Define the various problems.
if problem_number == 0:
diff --git a/compare3lesson.py b/compare3lesson.py
index 602bc29..6ee3579 100644
--- a/compare3lesson.py
+++ b/compare3lesson.py
@@ -85,7 +85,7 @@ class Compare3Lesson(ObjectArea):
self.problem_type = random.choice(PROBLEM_TYPES)
# Uncomment this to choose a particular problem type.
- #self.problem_type = 'amount'
+ #self.problem_type = 'area'
if self.problem_type == 'length':
self.problem = LengthProblem(self)
@@ -134,9 +134,9 @@ class Compare3Lesson(ObjectArea):
self.problem.shape2.draggable = False
# Scale and move both shapes to the answer box.
- print "scaling the shapes..."
- print "shape1 =",self.problem.shape1
- print "shape2 =",self.problem.shape2
+ #print "scaling the shapes..."
+ #print "shape1 =",self.problem.shape1
+ #print "shape2 =",self.problem.shape2
v = Vector(275 + 100, 350 + 75) - self.problem.shape1.pos
self.problem.shape1.pos += v
self.problem.shape2.pos += v
diff --git a/lengthproblem.py b/lengthproblem.py
index f80f831..ebe37b7 100644
--- a/lengthproblem.py
+++ b/lengthproblem.py
@@ -85,7 +85,7 @@ class LengthProblem(Problem):
(0, math.pi/4), (math.pi/4, 0), (0, math.pi/4), (math.pi/4, 0), (0, 0), (math.pi/2, 0), (0, math.pi/2) ])
# The total number of problems.
- n_problems = 36
+ n_problems = 18
# Choose a random problem.
problem_number = random.randrange(0,n_problems)
@@ -256,21 +256,6 @@ class LengthProblem(Problem):
return True
elif (self.answer == 'less' or self.answer == 'greater') and n_equal == 1:
return True
-
- # Test if one object is completely inside the other (areas are not equal)
- #area0 = self.shape1.area
- #area1 = self.shape2.area
- #
- #if area0 > area1:
- # object_larger = self.shape1
- # p_smaller = p1
- #else:
- # object_larger = self.shape2
- # p_smaller = p0
- #
- #for i in range(0,len(self.shape1.points)):
- # if not object_larger.contains_point(p_smaller[i]):
- # return False
return False
diff --git a/shapeobject.py b/shapeobject.py
index 2f3eb81..d2cba6a 100644
--- a/shapeobject.py
+++ b/shapeobject.py
@@ -85,7 +85,7 @@ class ShapeObject(MovableObject):
self.bounds_max += Vector(2, 2)
def get_bounds(self):
- print "ShapeObject get_bounds: ", self.bounds_min, self.bounds_max
+ #print "ShapeObject get_bounds: ", self.bounds_min, self.bounds_max
return self.bounds_min, self.bounds_max
def transform_point(self, p):
@@ -107,7 +107,7 @@ class ShapeObject(MovableObject):
self.container.select_object(self)
- if self.in_answer_box:
+ if self.in_answer_box and (self.container.problem_type == 'area' or self.container.problem_type == 'cutting'):
i = 0
for o in self.container.objects:
@@ -120,6 +120,12 @@ class ShapeObject(MovableObject):
self.container.select_object(self)
else:
self.container.select_object(other)
+
+ # Switch self and other to make selection work correctly in answer box?
+ #if not self.selected:
+ # self.container.select_object(other)
+ #else:
+ # self.container.select_object(self)
self.container.adjust_tab_order()