Skip to content

Commit

Permalink
Add notification on successful snapshot completion #45
Browse files Browse the repository at this point in the history
  • Loading branch information
Stvad committed Apr 9, 2019
1 parent 730c622 commit 915994d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crowd_anki/history/archiver_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
from ..export.anki_exporter import AnkiJsonExporter
from ..utils.config import SNAPSHOT_ROOT_DECKS
from ..utils.constants import USER_FILES_PATH
from ..utils.notifier import Notifier, AnkiUiNotifier


@dataclass
class ArchiverVendor:
window: Any
notifier: Notifier = field(default_factory=AnkiUiNotifier)
config: dict = field(init=False)

def __post_init__(self):
Expand Down Expand Up @@ -45,6 +47,8 @@ def do_snapshot(self, reason):
with progress_indicator(self.window, 'Taking CrowdAnki snapshot of all decks'):
self.all_deck_archiver().archive(overrides=self.overrides(),
reason=reason)
self.notifier.info("Snapshot successful",
f"The CrowdAnki snapshot to {self.snapshot_path().resolve()} successfully completed")

def overrides(self):
return self.deck_manager.for_names(self.config.get(SNAPSHOT_ROOT_DECKS))

0 comments on commit 915994d

Please sign in to comment.