Skip to content

Commit

Permalink
Feat/contact author & rate add-on
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Apr 26, 2024
1 parent 8dd0296 commit 14f6697
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
21 changes: 19 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from aqt.gui_hooks import deck_browser_will_show_options_menu, state_did_change
from aqt import mw
from aqt.qt import QAction
from aqt.utils import tooltip
from aqt.utils import tooltip, openLink
from typing import Callable

from .dsr_state import init_dsr_status_hook
Expand All @@ -21,7 +21,6 @@
from .browser.browser import init_browser
from .configuration import Config, run_on_configuration_change


"""
Acknowledgement to Arthur Milchior, Carlos Duarte and oakkitten.
I learnt a lot from their add-ons.
Expand Down Expand Up @@ -149,6 +148,20 @@ def reschedule_recent(did):
menu_disperse_siblings = build_action(disperse_siblings, "Disperse all siblings")


def contact_author(did=None):
openLink("https://github.com/open-spaced-repetition/fsrs4anki-helper")


menu_contact = build_action(contact_author, "Contact Author on GitHub")


def rate_on_ankiweb(did=None):
openLink("https://ankiweb.net/shared/review/759844606")
config.has_rated = True


menu_rate = build_action(rate_on_ankiweb, "Rate Add-on on AnkiWeb")

menu_for_helper = mw.form.menuTools.addMenu("FSRS4Anki Helper")
menu_for_helper.addAction(menu_auto_reschedule_after_sync)
menu_for_helper.addAction(menu_auto_disperse_after_sync)
Expand All @@ -166,6 +179,10 @@ def reschedule_recent(did):
menu_for_helper.addAction(menu_advance)
menu_for_helper.addAction(menu_reset)
menu_for_helper.addAction(menu_disperse_siblings)
menu_for_helper.addSeparator()
menu_for_helper.addAction(menu_contact)
if not config.has_rated:
menu_for_helper.addAction(menu_rate)


menu_apply_easy_days = build_action(easy_days, "Apply easy days now")
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"debug_notify": false,
"fsrs_stats": true,
"display_memory_state": false,
"auto_easy_days": false
"auto_easy_days": false,
"has_rated": false
}
10 changes: 10 additions & 0 deletions configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
FSRS_STATS = "fsrs_stats"
DISPLAY_MEMORY_STATE = "display_memory_state"
AUTO_EASY_DAYS = "auto_easy_days"
HAS_RATED = "has_rated"


def load_config():
Expand Down Expand Up @@ -157,3 +158,12 @@ def auto_easy_days(self):
def auto_easy_days(self, value):
self.data[AUTO_EASY_DAYS] = value
self.save()

@property
def has_rated(self):
return self.data[HAS_RATED]

@has_rated.setter
def has_rated(self, value):
self.data[HAS_RATED] = value
self.save()

0 comments on commit 14f6697

Please sign in to comment.