Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/testlesson.py
blob: 8d20c9ef92f21cb695a7cecf33b6cf20d2ca27e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright 2008 by Peter Moxhay and Wade Brainerd.  
# This file is part of Math.
#
# Math is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# Math is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Math.  If not, see <http://www.gnu.org/licenses/>.
from objectarea import ObjectArea, Color
from vector import Vector

from shapeobject import ShapeObject
from symbolobject import SymbolObject
from linesegmentobject import LineSegmentObject

import gtk, math, random

class TestLesson(ObjectArea):
    """Empty lesson containing a variety of test objects to interact with."""
    
    def __init__(self, activity):
        ObjectArea.__init__(self, activity)
        
        self.add_test_objects()

    def add_test_objects(self):
        SMALL_SQUARE_SHAPE = ( Vector(0, 0), Vector(200, 0), Vector(200, 200), Vector(0, 200) )
        SQUARE_SHAPE = ( Vector(0, 0), Vector(250, 0), Vector(250, 250), Vector(0, 250) )
        LARGE_SQUARE_SHAPE = ( Vector(0, 0), Vector(300, 0), Vector(300, 300), Vector(0, 300) )
        TRIANGLE_SHAPE = ( Vector(0, 0), Vector(250, 0), Vector(0, -250) )
        TRAPEZOID_SHAPE = ( Vector(0, 0), Vector(350, 0), Vector(150, -200), Vector(0, -200))
        
        shape_object1 = ShapeObject(Color.BLUE, 'C', SQUARE_SHAPE, Vector(200, 200), 0)
        shape_object2 = ShapeObject(Color.RED, 'B', LARGE_SQUARE_SHAPE, Vector(550, 400), math.pi/4)
        
        self.add_shape_object(shape_object1)
        self.add_shape_object(shape_object2)
        
        #self.add_object(SymbolObject((100, 500), '<'))
        #self.add_object(SymbolObject((200, 500), '='))
        #self.add_object(SymbolObject((300, 500), '>'))