From 0a839d765a2feeb1b4dc5d25ef863f03dafded6d Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 9 Jan 2025 15:06:56 -0300 Subject: [PATCH 1/4] feat: Add terms and policy submenu to AnkiHub menu --- ankihub/gui/menu.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ankihub/gui/menu.py b/ankihub/gui/menu.py index 52b71f1b6..50b73af9a 100644 --- a/ankihub/gui/menu.py +++ b/ankihub/gui/menu.py @@ -74,6 +74,7 @@ def refresh_ankihub_menu() -> None: _ankihub_login_setup(parent=menu_state.ankihub_menu) _config_setup(parent=menu_state.ankihub_menu) + _ankihub_terms_and_policy_setup(parent=menu_state.ankihub_menu) _ankihub_help_setup(parent=menu_state.ankihub_menu) @@ -520,6 +521,26 @@ def _trigger_install_release_version(): check_and_prompt_for_updates_on_main_window() +def _ankihub_terms_and_policy_setup(parent: QMenu): + """Set up the sub menu for terms and policy related items.""" + terms_and_policy_menu = QMenu("🤝 Terms and Policy", parent) + + q_terms_and_conditions_action = QAction("Terms && Conditions", terms_and_policy_menu) + qconnect( + q_terms_and_conditions_action.triggered, + lambda: openLink("https://community.ankihub.net/tos?_gl=1*14cx6gn*_ga*MTUwNTk4MjUuMTcwNDk5NTI1NA..*_ga_T2ZF93TKF6*MTczMzQyNTA4NS42Mi4xLjE3MzM0MjUyMDcuMC4wLjA."), + ) + terms_and_policy_menu.addAction(q_terms_and_conditions_action) + + q_privacy_policy_action = QAction("Privacy Policy", terms_and_policy_menu) + qconnect( + q_privacy_policy_action.triggered, + lambda: openLink("https://community.ankihub.net/privacy"), + ) + terms_and_policy_menu.addAction(q_privacy_policy_action) + + parent.addMenu(terms_and_policy_menu) + def _ankihub_logout_setup(parent: QMenu): q_action = QAction("🔑 Sign out", aqt.mw) qconnect(q_action.triggered, _confirm_sign_out) From 4da165a5ceb53dd5c06be4b7abbb068b197dd26e Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 9 Jan 2025 15:45:32 -0300 Subject: [PATCH 2/4] Fix static check errors --- ankihub/gui/menu.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ankihub/gui/menu.py b/ankihub/gui/menu.py index 50b73af9a..2e3ef71a9 100644 --- a/ankihub/gui/menu.py +++ b/ankihub/gui/menu.py @@ -525,10 +525,15 @@ def _ankihub_terms_and_policy_setup(parent: QMenu): """Set up the sub menu for terms and policy related items.""" terms_and_policy_menu = QMenu("🤝 Terms and Policy", parent) - q_terms_and_conditions_action = QAction("Terms && Conditions", terms_and_policy_menu) + q_terms_and_conditions_action = QAction( + "Terms && Conditions", terms_and_policy_menu + ) qconnect( q_terms_and_conditions_action.triggered, - lambda: openLink("https://community.ankihub.net/tos?_gl=1*14cx6gn*_ga*MTUwNTk4MjUuMTcwNDk5NTI1NA..*_ga_T2ZF93TKF6*MTczMzQyNTA4NS42Mi4xLjE3MzM0MjUyMDcuMC4wLjA."), + lambda: openLink( + """https://community.ankihub.net/tos?_gl=1*14cx6gn*_ga*MTUwNTk4MjUuMTcwNDk5NTI1NA..\ + *_ga_T2ZF93TKF6*MTczMzQyNTA4NS42Mi4xLjE3MzM0MjUyMDcuMC4wLjA.""" + ), ) terms_and_policy_menu.addAction(q_terms_and_conditions_action) @@ -541,6 +546,7 @@ def _ankihub_terms_and_policy_setup(parent: QMenu): parent.addMenu(terms_and_policy_menu) + def _ankihub_logout_setup(parent: QMenu): q_action = QAction("🔑 Sign out", aqt.mw) qconnect(q_action.triggered, _confirm_sign_out) From 041d527b344e323f8d37acd296ed5f29044064f2 Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 9 Jan 2025 16:12:20 -0300 Subject: [PATCH 3/4] feat: Add terms and policy submenu link to AnkiHub menu --- ankihub/gui/menu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ankihub/gui/menu.py b/ankihub/gui/menu.py index 2e3ef71a9..7896e68fc 100644 --- a/ankihub/gui/menu.py +++ b/ankihub/gui/menu.py @@ -531,8 +531,7 @@ def _ankihub_terms_and_policy_setup(parent: QMenu): qconnect( q_terms_and_conditions_action.triggered, lambda: openLink( - """https://community.ankihub.net/tos?_gl=1*14cx6gn*_ga*MTUwNTk4MjUuMTcwNDk5NTI1NA..\ - *_ga_T2ZF93TKF6*MTczMzQyNTA4NS42Mi4xLjE3MzM0MjUyMDcuMC4wLjA.""" + "https://community.ankihub.net/tos" ), ) terms_and_policy_menu.addAction(q_terms_and_conditions_action) From fe84a64931aca8f19454be970b1426a31365d5a7 Mon Sep 17 00:00:00 2001 From: Pedro Date: Thu, 9 Jan 2025 16:20:07 -0300 Subject: [PATCH 4/4] Fix static check errors --- ankihub/gui/menu.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ankihub/gui/menu.py b/ankihub/gui/menu.py index 7896e68fc..e0e158d44 100644 --- a/ankihub/gui/menu.py +++ b/ankihub/gui/menu.py @@ -530,9 +530,7 @@ def _ankihub_terms_and_policy_setup(parent: QMenu): ) qconnect( q_terms_and_conditions_action.triggered, - lambda: openLink( - "https://community.ankihub.net/tos" - ), + lambda: openLink("https://community.ankihub.net/tos"), ) terms_and_policy_menu.addAction(q_terms_and_conditions_action)