Skip to content

Commit 9e17545

Browse files
Use app.notify action
1 parent 8cd7c21 commit 9e17545

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

cursorless-talon/src/actions/homophones.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Optional
22

3-
from talon import actions, app
3+
from talon import actions
44

55
from ..targets.target_types import (
66
CursorlessExplicitTarget,
@@ -16,7 +16,7 @@ def cursorless_homophones_action(target: CursorlessExplicitTarget):
1616
try:
1717
updated_texts = list(map(get_next_homophone, texts))
1818
except LookupError as e:
19-
app.notify(str(e))
19+
actions.app.notify(str(e))
2020
return
2121
destination = PrimitiveDestination("to", target)
2222
cursorless_replace_action(destination, updated_texts)

cursorless-talon/src/cheatsheet/cheat_sheet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
class Actions:
2727
def private_cursorless_cheat_sheet_show_html():
2828
"""Show new cursorless html cheat sheet"""
29-
app.notify(
29+
actions.app.notify(
3030
'Please first focus an app that supports cursorless, eg say "focus code"'
3131
)
3232

3333
def private_cursorless_cheat_sheet_update_json():
3434
"""Update default cursorless cheatsheet json (for developer use only)"""
35-
app.notify(
35+
actions.app.notify(
3636
'Please first focus an app that supports cursorless, eg say "focus code"'
3737
)
3838

cursorless-talon/src/csv_overrides.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pathlib import Path
88
from typing import Callable, Iterable, Optional, TypedDict
99

10-
from talon import Context, Module, actions, app, fs, settings
10+
from talon import Context, Module, actions, fs, settings
1111

1212
from .conventions import get_cursorless_list_name
1313
from .vendor.inflection import pluralize
@@ -201,7 +201,7 @@ def check_for_duplicates(filename, default_values):
201201
existing_list_name = results_map[value]["list"]
202202
warning = f"WARNING ({filename}): Value `{value}` duplicated between lists '{existing_list_name}' and '{list_name}'"
203203
print(warning)
204-
app.notify(warning)
204+
actions.app.notify(warning)
205205

206206

207207
def is_removed(value: str):
@@ -359,7 +359,7 @@ def update_file(
359359
"See release notes for more info: "
360360
"https://github.com/cursorless-dev/cursorless/blob/main/CHANGELOG.md"
361361
)
362-
app.notify("🎉🎉 New cursorless features; see log")
362+
actions.app.notify("🎉🎉 New cursorless features; see log")
363363

364364
return current_values
365365

@@ -452,7 +452,7 @@ def read_file(
452452
used_identifiers.append(value)
453453

454454
if has_errors:
455-
app.notify("Cursorless settings error; see log")
455+
actions.app.notify("Cursorless settings error; see log")
456456

457457
return result, has_errors
458458

cursorless-talon/src/get_grapheme_spoken_form_entries.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Iterator, Mapping
55
from uu import Error
66

7-
from talon import app, registry, scope
7+
from talon import registry, scope, actions
88

99
from .spoken_forms_output import SpokenFormOutputEntry
1010

@@ -31,7 +31,7 @@ def get_graphemes_talon_list() -> dict[str, str]:
3131
# 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.
3232
# 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.
3333
if "en" in scope.get("language", {}):
34-
app.notify(f"Capture <{grapheme_capture_name}> isn't defined")
34+
actions.app.notify(f"Capture <{grapheme_capture_name}> isn't defined")
3535
print(
3636
f"Capture <{grapheme_capture_name}> isn't defined, which is required by Cursorless. Please check your community setup"
3737
)
@@ -56,7 +56,7 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]:
5656
# NB: [-1] because the last capture is the active one
5757
rule = registry.captures[capture_name][-1].rule.rule
5858
except Error:
59-
app.notify("Error constructing spoken forms for graphemes")
59+
actions.app.notify("Error constructing spoken forms for graphemes")
6060
print(f"Error getting rule for capture {capture_name}")
6161
return
6262
rule = rule.strip()
@@ -73,7 +73,7 @@ def generate_lists_from_capture(capture_name) -> Iterator[str]:
7373
component = "user." + component[5:]
7474
yield component
7575
else:
76-
app.notify("Error constructing spoken forms for graphemes")
76+
actions.app.notify("Error constructing spoken forms for graphemes")
7777
print(
7878
f"Unexpected component {component} while processing rule {rule} for capture {capture_name}"
7979
)
@@ -87,7 +87,7 @@ def get_id_to_talon_list(list_name: str) -> dict[str, str]:
8787
# NB: [-1] because the last list is the active one
8888
return typing.cast(dict[str, str], registry.lists[list_name][-1]).copy()
8989
except Error:
90-
app.notify(f"Error getting list {list_name}")
90+
actions.app.notify(f"Error getting list {list_name}")
9191
return {}
9292

9393

cursorless-talon/src/spoken_forms_output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33
from typing import TypedDict
44

5-
from talon import app
5+
from talon import actions
66

77
SPOKEN_FORMS_OUTPUT_PATH = Path.home() / ".cursorless" / "state.json"
88
STATE_JSON_VERSION_NUMBER = 0
@@ -27,7 +27,7 @@ def init(self):
2727
f"Error creating spoken form dir {SPOKEN_FORMS_OUTPUT_PATH.parent}"
2828
)
2929
print(error_message)
30-
app.notify(error_message)
30+
actions.app.notify(error_message)
3131

3232
def write(self, spoken_forms: list[SpokenFormOutputEntry]):
3333
with open(SPOKEN_FORMS_OUTPUT_PATH, "w", encoding="UTF-8") as out:
@@ -45,4 +45,4 @@ def write(self, spoken_forms: list[SpokenFormOutputEntry]):
4545
f"Error writing spoken form json {SPOKEN_FORMS_OUTPUT_PATH}"
4646
)
4747
print(error_message)
48-
app.notify(error_message)
48+
actions.app.notify(error_message)

0 commit comments

Comments
 (0)