Esempio n. 1
0
    def testAngles(self):
        a = angle.T('foo')

        self.assertEqual(a.get_current_angle(), 0.0)

        a.adjustment.set_value(a.adjustment.get_lower())
        self.assertEqual(a.get_current_angle(), -math.pi)

        a.adjustment.set_value(a.adjustment.get_upper())
        self.assertEqual(a.get_current_angle(), math.pi)
Esempio n. 2
0
    def testAngles(self):
        a = angle.T('foo')

        self.assertEqual(a.get_current_angle(), 0.0)

        a.adjustment.value = a.adjustment.lower
        self.assertEqual(a.get_current_angle(), -math.pi)

        a.adjustment.value = a.adjustment.upper
        self.assertEqual(a.get_current_angle(), math.pi)
Esempio n. 3
0
    def create_angle_widget(self,name,tip,axis, is4dsensitive):
        my_angle = angle.T(name)
        my_angle.connect('value-slightly-changed',
                         self.on_angle_slightly_changed)
        my_angle.connect('value-changed',
                         self.on_angle_changed)

        self.f.connect('parameters-changed',
                       self.update_angle_widget,my_angle)
        
        my_angle.axis = axis

        self.toolbar.add_widget(
            my_angle.widget,
            tip,
            tip)

        if is4dsensitive:
            self.four_d_sensitives.append(my_angle.widget)
Esempio n. 4
0
    def testPointerCoords(self):
        a = angle.T('foo')

        # 0 should point right
        self.assertNearlyEqual(a.pointer_coords(40, 0.0),
                               ((40 - angle.T.ptr_radius), 0))

        # so should 2pi
        self.assertNearlyEqual(a.pointer_coords(40, 2.0 * math.pi),
                               ((40 - angle.T.ptr_radius), 0))

        # pi = left
        self.assertNearlyEqual(a.pointer_coords(40, math.pi),
                               (-(40 - angle.T.ptr_radius), 0))

        # pi/2 = up
        self.assertNearlyEqual(a.pointer_coords(40, math.pi / 2.0),
                               (0, (40 - angle.T.ptr_radius)))

        # 3pi/2 = down
        self.assertNearlyEqual(a.pointer_coords(40, 3.0 * math.pi / 2.0),
                               (0, -(40 - angle.T.ptr_radius)))
Esempio n. 5
0
 def testCreate(self):
     a = angle.T("hello")
     self.assertTrue(a)
     self.assertEqual(a.adjustment.get_lower(), -math.pi)
     self.assertEqual(a.adjustment.get_upper(), math.pi)
     self.assertEqual(a.adjustment.get_value(), 0.0)
Esempio n. 6
0
 def testCreate(self):
     a = angle.T("hello")
     self.failUnless(a)
     self.assertEqual(a.adjustment.lower, -math.pi)
     self.assertEqual(a.adjustment.upper, math.pi)
     self.assertEqual(a.adjustment.value, 0.0)