def confirm_song_removal_invoke(parent, songs): songs = set(songs) if not songs: return True count = len(songs) song = next(iter(songs)) title = (ngettext("Remove track: \"%%(title)s\" from library?", "Remove %(count)d tracks from library?", count) % {'count': count}) % { 'title': song('title') or song('~basename')} prompt = ConfirmationPrompt(parent, title, "", _("Remove from Library"), ok_button_icon=Icons.LIST_REMOVE) return prompt.run() == ConfirmationPrompt.RESPONSE_INVOKE
def __remove(self, view) -> None: selection = self.view.get_selection() model, paths = selection.get_selected_rows() gone_dirs = [model[p][0] for p in paths or []] total = len(gone_dirs) if not total: return msg = (_("Remove {dir!r} and all its tracks?").format( dir=gone_dirs[0]) if total == 1 else _("Remove {n} library paths and their tracks?").format(n=total)) title = ngettext("Remove library path?", "Remove library paths?", total) prompt = ConfirmationPrompt(self, title, msg, _("Remove"), ok_button_icon=Icons.LIST_REMOVE) if prompt.run() == ConfirmationPrompt.RESPONSE_INVOKE: view.remove_selection() self.__save()