Spelling correction.
[adesklets.git] / test / test_events.py
blob6aecdc14f032286048734d2da4518590de4cdff1
1 """
2 test_events.py - S.Fourmanoit <syfou@users.sourceforge.net>, 2005
4 Small, non-exhaustive adesklets test script that test dynamic remapping
5 of events through the Events_handler::get_events() and
6 Events_handler::set_events(), introduced in adesklets 0.3.0.
8 All it does is to create a 100x100 pseudo-transparent managed window,
9 then catch MotionNotify events until clicked onto.
11 To try it:
12 - Install adesklets (>=0.3.0) with python support enabled (default)
13 - Run python test_events.py from this directory
14 """
15 import adesklets
17 class My_Events(adesklets.Events_handler):
18 def __init__(self):
19 adesklets.Events_handler.__init__(self)
21 def __del__(self):
22 adesklets.Events_handler.__del__(self)
24 def ready(self):
25 adesklets.window_resize(100,100)
26 adesklets.window_reset(adesklets.WINDOW_MANAGED)
27 adesklets.window_set_transparency(True)
28 adesklets.window_show()
30 def quit(self):
31 print 'Quitting...'
33 def alarm(self):
34 print 'Alarm. Next in 10 seconds.'
35 return 10
37 def motion_notify(self, delayed, x, y):
38 print 'Motion notify:', x, y, delayed
40 def button_press(self,delayed,x,y,button):
41 print '================= ',
42 events=self.get_events()
43 if events['MotionNotify']:
44 events['MotionNotify']=None
45 print 'stop',
46 else:
47 events['MotionNotify']=My_Events.motion_notify
48 print 'start',
49 print ' ================='
50 self.set_events(events)
52 My_Events().pause()