24 |
class MyModule(module.Module): |
class MyModule(module.Module): |
25 |
|
|
26 |
my_events = [X.ButtonPress, X.MotionNotify] |
my_events = [X.ButtonPress, X.MotionNotify] |
27 |
default_menu = {} |
|
28 |
|
default_menu = {0:'xterm',1:'gvim'} |
29 |
|
|
30 |
|
modifiers = {0:None, |
31 |
|
1:'Shift', |
32 |
|
2:None, |
33 |
|
3:None, |
34 |
|
4:'Control'} |
35 |
|
|
36 |
|
buttons = {1:'right', |
37 |
|
2:'middle', |
38 |
|
3:'left'} |
39 |
|
|
40 |
def load(self): |
def load(self): |
41 |
pass |
pass |
42 |
|
|
43 |
def handle_event(self,event): |
def handle_event(self,event): |
|
|
|
44 |
if event.type == X.ButtonPress: |
if event.type == X.ButtonPress: |
45 |
print "X.ButtonPress" |
if __debug__: |
46 |
|
print "Menus got X.ButtonPress", event.state, event.detail |
47 |
if event.type == X.MotionNotify: |
print "at ", event.root_x, "x", event.root_y |
|
print event.root_x, "x", event.root_y |
|
48 |
|
|
49 |
def run_program(prog, *args): |
def run_program(prog, *args): |
50 |
"""this works""" |
"""this works""" |
53 |
os.execvp(prog, (prog,) + args) |
os.execvp(prog, (prog,) + args) |
54 |
|
|
55 |
# XXX at the moment commands can't take argument |
# XXX at the moment commands can't take argument |
56 |
def load_menu(): |
def load_menu(self): |
57 |
"""creates a menu dictionary""" |
"""creates a menu dictionary""" |
58 |
if self.config.has_section(menu): |
if self.config.has_section("menu"): |
59 |
menu_dict = self.config.options(menu) |
menu_dict = self.config.options("menu") |
60 |
else: |
else: |
61 |
menu_dict = default_menu |
menu_dict = default_menu |
62 |
|
|
63 |
if __debug__: |
if __debug__: |
64 |
print menu_dict |
print menu_dict |
65 |
|
|
66 |
|
load_menu(self) |
67 |
|
if __debug__: |
68 |
|
print "Menu events: ", my_events |
69 |
|
print "buttons: ", buttons |
70 |
|
print "modifiers: ", modifiers |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
#################################################################### |
79 |
#import pygtk |
#import pygtk |
80 |
#pygtk.require("2.0") |
#pygtk.require("2.0") |
81 |
#from gtk import * |
#from gtk import * |