Merge pull request #887 from BlueGreenMagick/deck-rename-checkpoint

don't set checkpoint when deck rename is cancelled
This commit is contained in:
Damien Elmes 2021-01-04 13:44:28 +10:00 committed by GitHub
commit 03b10b0d44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,13 +93,13 @@ class NewSidebarTreeView(SidebarTreeViewBase):
m.exec_(QCursor.pos())
def rename_deck(self, item: "aqt.browser.SidebarItem") -> None:
self.mw.checkpoint(tr(TR.ACTIONS_RENAME_DECK))
deck = self.mw.col.decks.get(item.id)
old_name = deck["name"]
new_name = getOnlyText(tr(TR.DECKS_NEW_DECK_NAME), default=old_name)
new_name = new_name.replace('"', "")
if not new_name or new_name == old_name:
return
self.mw.checkpoint(tr(TR.ACTIONS_RENAME_DECK))
try:
self.mw.col.decks.rename(deck, new_name)
except DeckRenameError as e: