mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
nest NoteWithEmptyCards
This commit is contained in:
parent
aa82bb172d
commit
b9635ce936
4 changed files with 13 additions and 13 deletions
|
@ -47,7 +47,6 @@ SearchTerm = _pb.SearchTerm
|
||||||
Progress = _pb.Progress
|
Progress = _pb.Progress
|
||||||
Config = _pb.Config
|
Config = _pb.Config
|
||||||
EmptyCardsReport = _pb.EmptyCardsReport
|
EmptyCardsReport = _pb.EmptyCardsReport
|
||||||
NoteWithEmptyCards = _pb.NoteWithEmptyCards
|
|
||||||
GraphPreferences = _pb.GraphPreferences
|
GraphPreferences = _pb.GraphPreferences
|
||||||
BuiltinSort = _pb.SortOrder.Builtin
|
BuiltinSort = _pb.SortOrder.Builtin
|
||||||
Preferences = _pb.Preferences
|
Preferences = _pb.Preferences
|
||||||
|
|
|
@ -8,7 +8,7 @@ from concurrent.futures import Future
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from anki.collection import EmptyCardsReport, NoteWithEmptyCards
|
from anki.collection import EmptyCardsReport
|
||||||
from aqt import gui_hooks
|
from aqt import gui_hooks
|
||||||
from aqt.qt import QDialog, QDialogButtonBox, qconnect
|
from aqt.qt import QDialog, QDialogButtonBox, qconnect
|
||||||
from aqt.utils import TR, disable_help_button, restoreGeom, saveGeom, tooltip, tr
|
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:
|
def _delete_cards(self, keep_notes: bool) -> int:
|
||||||
to_delete = []
|
to_delete = []
|
||||||
note: NoteWithEmptyCards
|
note: EmptyCardsReport.NoteWithEmptyCards
|
||||||
for note in self.report.notes:
|
for note in self.report.notes:
|
||||||
if keep_notes and note.will_delete_note:
|
if keep_notes and note.will_delete_note:
|
||||||
# leave first card
|
# leave first card
|
||||||
|
|
|
@ -912,16 +912,15 @@ message AddNoteIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
message EmptyCardsReport {
|
message EmptyCardsReport {
|
||||||
|
message NoteWithEmptyCards {
|
||||||
|
int64 note_id = 1;
|
||||||
|
repeated int64 card_ids = 2;
|
||||||
|
bool will_delete_note = 3;
|
||||||
|
}
|
||||||
string report = 1;
|
string report = 1;
|
||||||
repeated NoteWithEmptyCards notes = 2;
|
repeated NoteWithEmptyCards notes = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NoteWithEmptyCards {
|
|
||||||
int64 note_id = 1;
|
|
||||||
repeated int64 card_ids = 2;
|
|
||||||
bool will_delete_note = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeckNames {
|
message DeckNames {
|
||||||
repeated DeckNameID entries = 1;
|
repeated DeckNameID entries = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,10 +438,12 @@ impl BackendService for Backend {
|
||||||
|
|
||||||
let mut outnotes = vec![];
|
let mut outnotes = vec![];
|
||||||
for (_ntid, notes) in empty {
|
for (_ntid, notes) in empty {
|
||||||
outnotes.extend(notes.into_iter().map(|e| pb::NoteWithEmptyCards {
|
outnotes.extend(notes.into_iter().map(|e| {
|
||||||
note_id: e.nid.0,
|
pb::empty_cards_report::NoteWithEmptyCards {
|
||||||
will_delete_note: e.empty.len() == e.current_count,
|
note_id: e.nid.0,
|
||||||
card_ids: e.empty.into_iter().map(|(_ord, id)| id.0).collect(),
|
will_delete_note: e.empty.len() == e.current_count,
|
||||||
|
card_ids: e.empty.into_iter().map(|(_ord, id)| id.0).collect(),
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
Ok(pb::EmptyCardsReport {
|
Ok(pb::EmptyCardsReport {
|
||||||
|
|
Loading…
Reference in a new issue