diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 39c5efceb..1d7c442e7 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -47,7 +47,6 @@ SearchTerm = _pb.SearchTerm Progress = _pb.Progress Config = _pb.Config EmptyCardsReport = _pb.EmptyCardsReport -NoteWithEmptyCards = _pb.NoteWithEmptyCards GraphPreferences = _pb.GraphPreferences BuiltinSort = _pb.SortOrder.Builtin Preferences = _pb.Preferences diff --git a/qt/aqt/emptycards.py b/qt/aqt/emptycards.py index 73b2e3087..eb8099cbf 100644 --- a/qt/aqt/emptycards.py +++ b/qt/aqt/emptycards.py @@ -8,7 +8,7 @@ from concurrent.futures import Future from typing import Any import aqt -from anki.collection import EmptyCardsReport, NoteWithEmptyCards +from anki.collection import EmptyCardsReport from aqt import gui_hooks from aqt.qt import QDialog, QDialogButtonBox, qconnect from aqt.utils import TR, disable_help_button, restoreGeom, saveGeom, tooltip, tr @@ -89,7 +89,7 @@ class EmptyCardsDialog(QDialog): def _delete_cards(self, keep_notes: bool) -> int: to_delete = [] - note: NoteWithEmptyCards + note: EmptyCardsReport.NoteWithEmptyCards for note in self.report.notes: if keep_notes and note.will_delete_note: # leave first card diff --git a/rslib/backend.proto b/rslib/backend.proto index eff0abee2..e5ddab6d5 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -912,16 +912,15 @@ message AddNoteIn { } message EmptyCardsReport { + message NoteWithEmptyCards { + int64 note_id = 1; + repeated int64 card_ids = 2; + bool will_delete_note = 3; + } string report = 1; repeated NoteWithEmptyCards notes = 2; } -message NoteWithEmptyCards { - int64 note_id = 1; - repeated int64 card_ids = 2; - bool will_delete_note = 3; -} - message DeckNames { repeated DeckNameID entries = 1; } diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index 2ac7b2400..905e2aec7 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -438,10 +438,12 @@ impl BackendService for Backend { let mut outnotes = vec![]; for (_ntid, notes) in empty { - outnotes.extend(notes.into_iter().map(|e| pb::NoteWithEmptyCards { - note_id: e.nid.0, - will_delete_note: e.empty.len() == e.current_count, - card_ids: e.empty.into_iter().map(|(_ord, id)| id.0).collect(), + outnotes.extend(notes.into_iter().map(|e| { + pb::empty_cards_report::NoteWithEmptyCards { + note_id: e.nid.0, + will_delete_note: e.empty.len() == e.current_count, + card_ids: e.empty.into_iter().map(|(_ord, id)| id.0).collect(), + } })) } Ok(pb::EmptyCardsReport {