def on_button_press_event(wid, event):
"""
on_button_press_event: Sa? tu?a t?kland???nda yap?lacak i?lem
Fare'nin sa? tu?una t?kland???nda bu fonksiyon tetiklenir. Fonksiyon içinde
T?klanan tu?un sa? tu? olup olmad??? sorgulan?r. E?er do?ru ise aç?l?r menü
Olu?turulur. Olu?turulam menü argümanlar?na sinyaller atan?r ve gösterilir.
"""
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 3:
menu = Gtk.Menu()
term = Gtk.ImageMenuItem("Terminal Aç")
term_img = Gtk.Image()
term_img.set_from_icon_name("utilities-terminal", Gtk.IconSize.MENU)
term.set_image(term_img)
term.set_always_show_image(True)
copy = Gtk.ImageMenuItem("Kopyala")
copy_img = Gtk.Image()
copy_img.set_from_icon_name("edit-copy", Gtk.IconSize.MENU)
copy.set_image(copy_img)
copy.set_always_show_image(True)
paste = Gtk.ImageMenuItem("Yap??t?r")
paste_img = Gtk.Image()
paste_img.set_from_icon_name("edit-paste", Gtk.IconSize.MENU)
paste.set_image(paste_img)
paste.set_always_show_image(True)
menu.append(term)
menu.append(Gtk.SeparatorMenuItem())
menu.append(copy)
menu.append(paste)
term.connect("activate", RightClick.open_terminal)
copy.connect("activate", RightClick.copy_text)
paste.connect("activate", RightClick.paste_text)
menu.show_all()
menu.popup(None, None, None, None, event.button, event.time)
return True
评论列表
文章目录