From 49dd7a2ca1977123c115614196cd99852972b955 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 21 Nov 2024 12:23:19 +0100 Subject: [PATCH 1/4] Check for community installation --- cursorless-talon/src/check_community_repo.py | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 cursorless-talon/src/check_community_repo.py diff --git a/cursorless-talon/src/check_community_repo.py b/cursorless-talon/src/check_community_repo.py new file mode 100644 index 0000000000..62c4332539 --- /dev/null +++ b/cursorless-talon/src/check_community_repo.py @@ -0,0 +1,34 @@ +from talon import app, registry + +required_captures = [ + "number_small", + "user.any_alphanumeric_key", + "user.formatters", + "user.ordinals_small", +] + +required_actions = [ + "user.homophones_get", + "user.reformat_text", +] + + +def onready(): + missing_captures = [ + capture for capture in required_captures if capture not in registry.captures + ] + missing_actions = [ + action for action in required_actions if action not in registry.actions + ] + errors = [] + if missing_captures: + errors.append(f"Missing captures: {', '.join(missing_captures)}") + if missing_actions: + errors.append(f"Missing actions: {', '.join(missing_actions)}") + if errors: + errors.insert(0, "https://github.com/talonhub/community") + message = "\n".join(errors) + app.notify("Cursorless missing community repository", body=message) + + +app.register("ready", onready) From bacf1a90e632abf8bec7fd06e646341d468be1c8 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Thu, 21 Nov 2024 12:26:28 +0100 Subject: [PATCH 2/4] Renamed funk --- cursorless-talon/src/check_community_repo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cursorless-talon/src/check_community_repo.py b/cursorless-talon/src/check_community_repo.py index 62c4332539..1af5272336 100644 --- a/cursorless-talon/src/check_community_repo.py +++ b/cursorless-talon/src/check_community_repo.py @@ -13,7 +13,7 @@ ] -def onready(): +def on_ready(): missing_captures = [ capture for capture in required_captures if capture not in registry.captures ] @@ -31,4 +31,4 @@ def onready(): app.notify("Cursorless missing community repository", body=message) -app.register("ready", onready) +app.register("ready", on_ready) From feec31c40c994d01b9672ae98b50b93f18651976 Mon Sep 17 00:00:00 2001 From: Andreas Arvidsson Date: Sun, 1 Dec 2024 10:19:41 +0100 Subject: [PATCH 3/4] Update message --- cursorless-talon/src/check_community_repo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cursorless-talon/src/check_community_repo.py b/cursorless-talon/src/check_community_repo.py index 1af5272336..86bf9c0669 100644 --- a/cursorless-talon/src/check_community_repo.py +++ b/cursorless-talon/src/check_community_repo.py @@ -26,9 +26,11 @@ def on_ready(): if missing_actions: errors.append(f"Missing actions: {', '.join(missing_actions)}") if errors: - errors.insert(0, "https://github.com/talonhub/community") - message = "\n".join(errors) - app.notify("Cursorless missing community repository", body=message) + print("\n".join(errors)) + app.notify( + "Cursorless missing community repository", + body="https://github.com/talonhub/community", + ) app.register("ready", on_ready) From 93b893501fc10793d69827445b0c64813588da2b Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Thu, 12 Dec 2024 19:15:32 +0000 Subject: [PATCH 4/4] Update cursorless-talon/src/check_community_repo.py --- cursorless-talon/src/check_community_repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cursorless-talon/src/check_community_repo.py b/cursorless-talon/src/check_community_repo.py index 86bf9c0669..4338af21ce 100644 --- a/cursorless-talon/src/check_community_repo.py +++ b/cursorless-talon/src/check_community_repo.py @@ -28,7 +28,7 @@ def on_ready(): if errors: print("\n".join(errors)) app.notify( - "Cursorless missing community repository", + "Please install the community repository", body="https://github.com/talonhub/community", )