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.
12 - Install adesklets (>=0.3.0) with python support enabled (default)
13 - Run python test_events.py from this directory
17 class My_Events(adesklets
.Events_handler
):
19 adesklets
.Events_handler
.__init
__(self
)
22 adesklets
.Events_handler
.__del
__(self
)
25 adesklets
.window_resize(100,100)
26 adesklets
.window_reset(adesklets
.WINDOW_MANAGED
)
27 adesklets
.window_set_transparency(True)
28 adesklets
.window_show()
34 print 'Alarm. Next in 10 seconds.'
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
47 events
['MotionNotify']=My_Events
.motion_notify
49 print ' ================='
50 self
.set_events(events
)