Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created a menu action to run create a snapshot and exit anki #160

Merged
merged 1 commit into from
Dec 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crowd_anki/anki/ui/action_vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dataclasses import dataclass, field
from typing import Callable, Any, Optional
from aqt import mw

from ...github.github_importer import GitImporter
from ...history.archiver_vendor import ArchiverVendor
Expand All @@ -24,7 +25,7 @@ def action(self, name, handler):
return action

def actions(self):
return [self.import_action(), self.github_import(), self.snapshot()]
return [self.import_action(), self.github_import(), self.snapshot(), self.snapshot_and_exit()]

def import_action(self):
return self.action('CrowdAnki: Import from disk',
Expand All @@ -36,3 +37,10 @@ def github_import(self):

def snapshot(self):
return self.action('CrowdAnki: Snapshot', self.archiver_vendor.do_manual_snapshot)

def _snapshot_and_exit(self):
self.archiver_vendor.do_manual_snapshot()
mw.close()

def snapshot_and_exit(self):
return self.action('CrowdAnki: Snapshot and Exit', self._snapshot_and_exit)