-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdebug.py
More file actions
31 lines (25 loc) · 994 Bytes
/
Copy pathdebug.py
File metadata and controls
31 lines (25 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from talon.engine import engine
import json
def listener(topic, m):
cmd = m["cmd"]
# Just comment these out if you want the hairy objects.
if topic == "cmd" and cmd["cmd"] == "g.load" and m["success"] == True:
print("[grammar reloaded]")
elif topic == "cmd" and cmd["cmd"] == "g.listset":
print(f'[list {m["cmd"]["list"]} updated: {m["cmd"]["items"][0:6]}...]')
elif topic == "cmd" and cmd["cmd"] == "g.update":
print("[user scripts updated]")
elif topic == "cmd" and cmd["cmd"] == "g.unload":
print("[user scripts unloaded]")
elif topic == "cmd" and cmd["cmd"] in {"w.add", "w.remove"}:
print("[dragon vocab updated]")
elif topic == "phrase" and cmd == "p.end":
if "parsed" in m:
print(f'[phase: {m["parsed"]}]')
else:
print(topic, m)
# Uncomment to enable.
# engine.register('', listener)
def unload():
engine.unregister("", listener)
# unload()