diff --git a/cursorless-talon/src/actions/homophones.py b/cursorless-talon/src/actions/homophones.py index 4b3b7f3280..03ee08073a 100644 --- a/cursorless-talon/src/actions/homophones.py +++ b/cursorless-talon/src/actions/homophones.py @@ -1,6 +1,6 @@ from typing import Optional -from talon import actions, app +from talon import actions from ..targets.target_types import ( CursorlessExplicitTarget, @@ -16,7 +16,7 @@ def cursorless_homophones_action(target: CursorlessExplicitTarget): try: updated_texts = list(map(get_next_homophone, texts)) except LookupError as e: - app.notify(str(e)) + actions.app.notify(str(e)) return destination = PrimitiveDestination("to", target) cursorless_replace_action(destination, updated_texts) diff --git a/cursorless-talon/src/cheatsheet/cheat_sheet.py b/cursorless-talon/src/cheatsheet/cheat_sheet.py index 7b82177e27..13a9d76a39 100644 --- a/cursorless-talon/src/cheatsheet/cheat_sheet.py +++ b/cursorless-talon/src/cheatsheet/cheat_sheet.py @@ -26,13 +26,13 @@ class Actions: def private_cursorless_cheat_sheet_show_html(): """Show new cursorless html cheat sheet""" - app.notify( + actions.app.notify( 'Please first focus an app that supports cursorless, eg say "focus code"' ) def private_cursorless_cheat_sheet_update_json(): """Update default cursorless cheatsheet json (for developer use only)""" - app.notify( + actions.app.notify( 'Please first focus an app that supports cursorless, eg say "focus code"' ) diff --git a/cursorless-talon/src/csv_overrides.py b/cursorless-talon/src/csv_overrides.py index d87f1c4ed1..8917bf4777 100644 --- a/cursorless-talon/src/csv_overrides.py +++ b/cursorless-talon/src/csv_overrides.py @@ -7,7 +7,7 @@ from pathlib import Path from typing import Callable, Iterable, Optional, TypedDict -from talon import Context, Module, actions, app, fs, settings +from talon import Context, Module, actions, fs, settings from .conventions import get_cursorless_list_name from .vendor.inflection import pluralize @@ -201,7 +201,7 @@ def check_for_duplicates(filename, default_values): existing_list_name = results_map[value]["list"] warning = f"WARNING ({filename}): Value `{value}` duplicated between lists '{existing_list_name}' and '{list_name}'" print(warning) - app.notify(warning) + actions.app.notify(warning) def is_removed(value: str): @@ -359,7 +359,7 @@ def update_file( "See release notes for more info: " "https://github.com/cursorless-dev/cursorless/blob/main/CHANGELOG.md" ) - app.notify("🎉🎉 New cursorless features; see log") + actions.app.notify("🎉🎉 New cursorless features; see log") return current_values @@ -452,7 +452,7 @@ def read_file( used_identifiers.append(value) if has_errors: - app.notify("Cursorless settings error; see log") + actions.app.notify("Cursorless settings error; see log") return result, has_errors diff --git a/cursorless-talon/src/get_grapheme_spoken_form_entries.py b/cursorless-talon/src/get_grapheme_spoken_form_entries.py index 42ff196b00..cb1f6045ad 100644 --- a/cursorless-talon/src/get_grapheme_spoken_form_entries.py +++ b/cursorless-talon/src/get_grapheme_spoken_form_entries.py @@ -4,7 +4,7 @@ from typing import Iterator, Mapping from uu import Error -from talon import app, registry, scope +from talon import registry, scope, actions from .spoken_forms_output import SpokenFormOutputEntry @@ -31,7 +31,7 @@ def get_graphemes_talon_list() -> dict[str, str]: # We require this capture, and expect it to be defined. We want to show a user friendly error if it isn't present (usually indicating a problem with their community.git setup) and we think the user is going to use Cursorless. # However, sometimes users use different dictation engines (Vosk, Webspeech) with entirely different/smaller grammars that don't have the capture, and this code will run then, and falsely error. We don't want to show an error in that case because they don't plan to actually use Cursorless. if "en" in scope.get("language", {}): - app.notify(f"Capture <{grapheme_capture_name}> isn't defined") + actions.app.notify(f"Capture <{grapheme_capture_name}> isn't defined") print( f"Capture <{grapheme_capture_name}> isn't defined, which is required by Cursorless. Please check your community setup" ) @@ -56,7 +56,7 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]: # NB: [-1] because the last capture is the active one rule = registry.captures[capture_name][-1].rule.rule except Error: - app.notify("Error constructing spoken forms for graphemes") + actions.app.notify("Error constructing spoken forms for graphemes") print(f"Error getting rule for capture {capture_name}") return rule = rule.strip() @@ -73,7 +73,7 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]: component = "user." + component[5:] yield component else: - app.notify("Error constructing spoken forms for graphemes") + actions.app.notify("Error constructing spoken forms for graphemes") print( f"Unexpected component {component} while processing rule {rule} for capture {capture_name}" ) @@ -87,7 +87,7 @@ def get_id_to_talon_list(list_name: str) -> dict[str, str]: # NB: [-1] because the last list is the active one return typing.cast(dict[str, str], registry.lists[list_name][-1]).copy() except Error: - app.notify(f"Error getting list {list_name}") + actions.app.notify(f"Error getting list {list_name}") return {} diff --git a/cursorless-talon/src/spoken_forms_output.py b/cursorless-talon/src/spoken_forms_output.py index 6961c98ec2..7e0015a5c1 100644 --- a/cursorless-talon/src/spoken_forms_output.py +++ b/cursorless-talon/src/spoken_forms_output.py @@ -2,7 +2,7 @@ from pathlib import Path from typing import TypedDict -from talon import app +from talon import actions SPOKEN_FORMS_OUTPUT_PATH = Path.home() / ".cursorless" / "state.json" STATE_JSON_VERSION_NUMBER = 0 @@ -27,7 +27,7 @@ def init(self): f"Error creating spoken form dir {SPOKEN_FORMS_OUTPUT_PATH.parent}" ) print(error_message) - app.notify(error_message) + actions.app.notify(error_message) def write(self, spoken_forms: list[SpokenFormOutputEntry]): with open(SPOKEN_FORMS_OUTPUT_PATH, "w", encoding="UTF-8") as out: @@ -45,4 +45,4 @@ def write(self, spoken_forms: list[SpokenFormOutputEntry]): f"Error writing spoken form json {SPOKEN_FORMS_OUTPUT_PATH}" ) print(error_message) - app.notify(error_message) + actions.app.notify(error_message)