53 |
|
|
54 |
win = GtkWindow() |
win = GtkWindow() |
55 |
win.connect("destroy", mainquit) |
win.connect("destroy", mainquit) |
56 |
win.set_border_width(1) |
win.set_border_width(5) |
57 |
|
|
58 |
# theres a constant GTK_WIN_POS_MOUSE in GTK.py, should use it |
# theres a constant GTK_WIN_POS_MOUSE in GTK.py, should use it |
59 |
win.set_position(2) |
#win.set_position(2) |
60 |
event_box = GtkEventBox() |
#event_box = GtkEventBox() |
61 |
# ALL_EVENTS_MASK is a shotgun approach, we don't need all of them |
# ALL_EVENTS_MASK is a shotgun approach, we don't need all of them |
62 |
event_box.set_events(GDK.ALL_EVENTS_MASK) |
#event_box.set_events(GDK.ALL_EVENTS_MASK) |
63 |
|
|
|
root_menu.show() |
|
64 |
vbox = GtkVBox() |
vbox = GtkVBox() |
65 |
vbox.pack_start(root_menu, FALSE, FALSE, 0) |
vbox.pack_start(root_menu, FALSE, FALSE, 0) |
66 |
|
win.add(vbox) |
67 |
vbox.show() |
vbox.show() |
68 |
event_box.add(vbox) |
root_menu.show() |
69 |
|
#event_box.add(vbox) |
70 |
|
|
71 |
win.show() |
#win.show() |
72 |
|
|
73 |
def draw_menu(self): |
def draw_menu(self): |
74 |
|
self.win.set_position(2) |
75 |
|
self.win.show() |
76 |
mainloop() |
mainloop() |
77 |
|
|
78 |
class MyModule(module.Module): |
class MyModule(module.Module): |
83 |
pass |
pass |
84 |
|
|
85 |
def handle_event(self,event): |
def handle_event(self,event): |
86 |
if event.type == X.ButtonPress and event.mask == 1: |
if event.type == X.ButtonPress:# and event.mask == 1: |
87 |
print "We should draw a menu now" |
print "We should draw a menu now" |
88 |
self.root_menu.draw_menu() |
self.root_menu.draw_menu() |
89 |
|
if event.type == X.ButtonPress: |
90 |
|
self.root_menu._quit() |
91 |
|
|
92 |
|
|
93 |
#EOF |
#EOF |