catch attempts to nest under a filtered deck; don't show traceback
This commit is contained in:
parent
5564fd9e13
commit
32af54cd4d
@ -1,4 +1,4 @@
|
|||||||
errors-invalid-input-empty = Invalid input.
|
errors-invalid-input-empty = Invalid input.
|
||||||
errors-invalid-input-details = Invalid input: { $details }
|
errors-invalid-input-details = Invalid input: { $details }
|
||||||
errors-parse-number-fail = A number was invalid or out of range.
|
errors-parse-number-fail = A number was invalid or out of range.
|
||||||
errors-filtered-parent-deck = Invalid deck name: Filtered decks cannot be parent decks.
|
errors-filtered-parent-deck = Filtered decks can not have child decks.
|
||||||
|
@ -287,7 +287,11 @@ class DeckBrowser:
|
|||||||
self._renderPage(reuse=True)
|
self._renderPage(reuse=True)
|
||||||
|
|
||||||
def _handle_drag_and_drop(self, source: int, target: int) -> None:
|
def _handle_drag_and_drop(self, source: int, target: int) -> None:
|
||||||
self.mw.col.decks.drag_drop_decks([source], target)
|
try:
|
||||||
|
self.mw.col.decks.drag_drop_decks([source], target)
|
||||||
|
except Exception as e:
|
||||||
|
showWarning(str(e))
|
||||||
|
return
|
||||||
gui_hooks.sidebar_should_refresh_decks()
|
gui_hooks.sidebar_should_refresh_decks()
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
@ -472,7 +472,11 @@ class SidebarTreeView(QTreeView):
|
|||||||
|
|
||||||
def on_done(fut: Future) -> None:
|
def on_done(fut: Future) -> None:
|
||||||
self.browser.model.endReset()
|
self.browser.model.endReset()
|
||||||
fut.result()
|
try:
|
||||||
|
fut.result()
|
||||||
|
except Exception as e:
|
||||||
|
showWarning(str(e))
|
||||||
|
return
|
||||||
self.refresh()
|
self.refresh()
|
||||||
self.mw.deckBrowser.refresh()
|
self.mw.deckBrowser.refresh()
|
||||||
|
|
||||||
|
@ -605,6 +605,9 @@ impl Collection {
|
|||||||
let mut target_name = None;
|
let mut target_name = None;
|
||||||
if let Some(target) = target {
|
if let Some(target) = target {
|
||||||
if let Some(target) = col.storage.get_deck(target)? {
|
if let Some(target) = col.storage.get_deck(target)? {
|
||||||
|
if target.is_filtered() {
|
||||||
|
return Err(AnkiError::DeckIsFiltered);
|
||||||
|
}
|
||||||
target_deck = target;
|
target_deck = target;
|
||||||
target_name = Some(target_deck.name.as_str());
|
target_name = Some(target_deck.name.as_str());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user