def do_initialize_popup(self, menu):
'''
Disable some items in popup menu for only tagged pages mode.
Although it is possible to leave it as is but it is not
recommended to create or change page names since not all pages
are shown.
'''
model = self.get_model()
if not isinstance(model, gtk.TreeModelFilter):
PageTreeView.do_initialize_popup(self, menu)
return
path = self.get_selected_path() or Path(':')
item = gtk.MenuItem(_('Open in New Window'))
item.connect('activate', lambda o: self.ui.open_new_window(path))
menu.append(item)
menu.append(gtk.SeparatorMenuItem())
item = gtk.ImageMenuItem('gtk-copy')
item.connect('activate', lambda o: self.do_copy())
menu.append(item)
self.populate_popup_expand_collapse(menu)
menu.show_all()
评论列表
文章目录