Skip to content

Commit

Permalink
Refactor dragon engine (talonhub#1505)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson authored Jul 21, 2024
1 parent bed708a commit bcd6a64
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
22 changes: 22 additions & 0 deletions core/dragon_engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from talon import Module, speech_system

mod = Module()


@mod.action_class
class Actions:
def dragon_engine_sleep():
"""Sleep the dragon engine"""
speech_system.engine_mimic("go to sleep"),

def dragon_engine_wake():
"""Wake the dragon engine"""
speech_system.engine_mimic("wake up"),

def dragon_engine_command_mode():
"""Switch dragon to command mode. Requires Pro."""
speech_system.engine_mimic("switch to command mode")

def dragon_engine_normal_mode():
"""Switch dragon to normal mode. Requires Pro."""
speech_system.engine_mimic("start normal mode")
18 changes: 0 additions & 18 deletions core/engine.py

This file was deleted.

12 changes: 6 additions & 6 deletions core/modes/modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def talon_mode():
# app.notify(engine)
if "dragon" in engine:
if app.platform == "mac":
actions.user.engine_sleep()
actions.user.dragon_engine_sleep()
elif app.platform == "windows":
actions.user.engine_wake()
actions.user.dragon_engine_wake()
# note: this may not do anything for all versions of Dragon. Requires Pro.
actions.user.engine_mimic("switch to command mode")
actions.user.dragon_engine_command_mode()

def dragon_mode():
"""For windows and Mac with Dragon, disables Talon commands and exits Dragon's command mode"""
Expand All @@ -60,8 +60,8 @@ def dragon_mode():
# app.notify("dragon mode")
actions.speech.disable()
if app.platform == "mac":
actions.user.engine_wake()
actions.user.dragon_engine_wake()
elif app.platform == "windows":
actions.user.engine_wake()
actions.user.dragon_engine_wake()
# note: this may not do anything for all versions of Dragon. Requires Pro.
actions.user.engine_mimic("start normal mode")
actions.user.dragon_engine_normal_mode()
2 changes: 1 addition & 1 deletion core/modes/modes_dragon.talon
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ speech.engine: dragon
user.help_hide()
user.mouse_sleep()
speech.disable()
user.engine_sleep()
user.dragon_engine_sleep()

0 comments on commit bcd6a64

Please sign in to comment.