def on_selection_changed(self, selection): model, iter = selection.get_selected() if iter is not None: self.selected_path = model.get_path(iter) self.selected_book = Book.fetch(model[iter][self.ISBN], model[iter][self.TITLE], model[iter][self.AUTHOR], self.parent.db) self.parent.set_active_book(self.selected_book) else: self.selection = None self.selected_book = None