Ejemplo n.º 1
0
 def _destroy(cls, *args):
     """
     This will clean up any class level storage.
     """
     App._destroy(*args)  # hit the App class first
     MathApp._mathVisualList = []
     MathApp._mathDynamicList = []
     MathApp._mathMovableList = []
     MathApp._mathSelectableList = []
     MathApp._mathStrokableList = []
     MathApp._viewNotificationList = []
Ejemplo n.º 2
0
 def test_app(self):
     a3 = App(100, 100)
     # event handling
     a3.listenKeyEvent(KeyEvent.keydown, "space", self.spacehandler)
     a3.listenMouseEvent(MouseEvent.mousewheel, self.wheelhandler)
     key = keyevent('keydown', 32)
     a3._keyEvent(key)
     mouse = mouseevent('wheel', 1, 2, 99)
     a3._mouseEvent(mouse)
     # confirm no events after unlisten
     a3.unlistenKeyEvent(KeyEvent.keydown, "space", self.spacehandler)
     a3.unlistenMouseEvent(MouseEvent.mousewheel, self.wheelhandler)
     a3._keyEvent(key)
     a3._mouseEvent(mouse)
     # assert that each handler was executed only once
     self.assertEqual(self.keyevtx, 1)
     self.assertEqual(self.mouseevtx, 1)
     # run the app
     a3.run()
     # and destroy it
     a3._destroy()
Ejemplo n.º 3
0
 def test_app(self):
   a3 = App(100,100)
   # event handling
   a3.listenKeyEvent(KeyEvent.keydown, "space", self.spacehandler)
   a3.listenMouseEvent(MouseEvent.mousewheel, self.wheelhandler)
   key = keyevent('keydown', 32)
   a3._keyEvent(key)
   mouse = mouseevent('wheel', 1, 2, 99)
   a3._mouseEvent(mouse)
   # confirm no events after unlisten
   a3.unlistenKeyEvent(KeyEvent.keydown, "space", self.spacehandler)
   a3.unlistenMouseEvent(MouseEvent.mousewheel, self.wheelhandler)
   a3._keyEvent(key)
   a3._mouseEvent(mouse)
   # assert that each handler was executed only once
   self.assertEqual(self.keyevtx, 1)
   self.assertEqual(self.mouseevtx, 1)
   # run the app
   a3.run()
   # and destroy it
   a3._destroy()