def METHOD_NAME(self, treeview, event):
    if event.button == 3:  # right click
        pathinfo = treeview.get_path_at_pos(int(event.x), int(event.y))
        if pathinfo is not None:
            path, col = pathinfo[0], pathinfo[1]
            treeview.grab_focus()
            treeview.set_cursor(path, col, 0)
            self.menu.show_all()
            self.menu.popup(
                None, None, None, None, event.button, Gtk.get_current_event_time()
            )
        return True
    return False