Пример #1
0
def _add_typeable(name, char):
    # Add a character to the typeables dictionary if it is typeable with
    # the current keyboard layout or log an error if it isn't.
    try:
        typeables[name] = keyboard.get_typeable(char)
    except ValueError as e:
        _log.error(e)
Пример #2
0
def _add_typeable(name, char):
    # Add a character to the typeables dictionary if it is typeable with
    # the current keyboard layout.
    try:
        typeables[name] = keyboard.get_typeable(char)
    except ValueError:
        # Errors or log messages will occur later if code attempts to use
        # missing typeables.
        pass
Пример #3
0
    Window,
    Config,
    Section,
    Item,
    IntegerRef,
    Alternative,
    RuleRef,
    Repetition,
    CompoundRule,
    AppContext,
)

from dragonfly.actions.keyboard import keyboard
from dragonfly.actions.typeables import typeables
if 'semicolon' not in typeables:
    typeables["semicolon"] = keyboard.get_typeable(char=';')

release = Key("shift:up, ctrl:up, alt:up, win:up")


def cancel_and_sleep(text=None, text2=None):
    """Used to cancel an ongoing dictation and puts microphone to sleep.

    This method notifies the user that the dictation was in fact canceled,
     a message in the Natlink feedback window.
    Then the the microphone is put to sleep.
    Example:
    "'random mumbling go to sleep'" => Microphone sleep.

    """
    print("* Dictation canceled. Going to sleep. *")
Пример #4
0
#   <http://www.gnu.org/licenses/>.
#
"""
    This file builds the mapping from key-name to Typeable instances.
"""

import win32con
from dragonfly.actions.keyboard import keyboard, Typeable

#---------------------------------------------------------------------------
# Mapping of name -> typeable.

typeables = {
    # Alphanumeric keys
    "a":
    keyboard.get_typeable(char='a'),
    "alpha":
    keyboard.get_typeable(char='a'),
    "b":
    keyboard.get_typeable(char='b'),
    "bravo":
    keyboard.get_typeable(char='b'),
    "c":
    keyboard.get_typeable(char='c'),
    "charlie":
    keyboard.get_typeable(char='c'),
    "d":
    keyboard.get_typeable(char='d'),
    "delta":
    keyboard.get_typeable(char='d'),
    "e":
)

from lib.dynamic_aenea import (
    GlobalDynamicContext,
    Key,
    Text,
)

import win32con
from dragonfly.actions.keyboard import Typeable, keyboard
from dragonfly.actions.typeables import typeables
if not 'Control_R' in typeables:
    keycode = win32con.VK_RCONTROL
    typeables["Control_R"] = Typeable(code=keycode, name="Control_R")
if not 'semicolon' in typeables:
    typeables["semicolon"] = keyboard.get_typeable(char=';')

import lib.config
config = lib.config.get_config()

import lib.sound as sound
from lib.format import (
    camel_case_count,
    pascal_case_count,
    snake_case_count,
    squash_count,
    expand_count,
    uppercase_count,
    lowercase_count,
    format_text,
    FormatTypes as ft,
Пример #6
0
 "f10": Typeable(code=win32con.VK_F10, name="f10"),
 "f11": Typeable(code=win32con.VK_F11, name="f11"),
 "f12": Typeable(code=win32con.VK_F12, name="f12"),
 "f13": Typeable(code=win32con.VK_F13, name="f13"),
 "f14": Typeable(code=win32con.VK_F14, name="f14"),
 "f15": Typeable(code=win32con.VK_F15, name="f15"),
 "f16": Typeable(code=win32con.VK_F16, name="f16"),
 "f17": Typeable(code=win32con.VK_F17, name="f17"),
 "f18": Typeable(code=win32con.VK_F18, name="f18"),
 "f19": Typeable(code=win32con.VK_F19, name="f19"),
 "f20": Typeable(code=win32con.VK_F20, name="f20"),
 "f21": Typeable(code=win32con.VK_F21, name="f21"),
 "f22": Typeable(code=win32con.VK_F22, name="f22"),
 "f23": Typeable(code=win32con.VK_F23, name="f23"),
 "f24": Typeable(code=win32con.VK_F24, name="f24"),
 "alpha": keyboard.get_typeable(char="a"),
 "a": keyboard.get_typeable(char="a"),
 "bravo": keyboard.get_typeable(char="b"),
 "b": keyboard.get_typeable(char="b"),
 "charlie": keyboard.get_typeable(char="c"),
 "c": keyboard.get_typeable(char="c"),
 "delta": keyboard.get_typeable(char="d"),
 "d": keyboard.get_typeable(char="d"),
 "echo": keyboard.get_typeable(char="e"),
 "e": keyboard.get_typeable(char="e"),
 "foxtrot": keyboard.get_typeable(char="f"),
 "f": keyboard.get_typeable(char="f"),
 "golf": keyboard.get_typeable(char="g"),
 "g": keyboard.get_typeable(char="g"),
 "hotel": keyboard.get_typeable(char="h"),
 "h": keyboard.get_typeable(char="h"),
Пример #7
0
    "f11":          Typeable(code=win32con.VK_F11,       name="f11"),
    "f12":          Typeable(code=win32con.VK_F12,       name="f12"),
    "f13":          Typeable(code=win32con.VK_F13,       name="f13"),
    "f14":          Typeable(code=win32con.VK_F14,       name="f14"),
    "f15":          Typeable(code=win32con.VK_F15,       name="f15"),
    "f16":          Typeable(code=win32con.VK_F16,       name="f16"),
    "f17":          Typeable(code=win32con.VK_F17,       name="f17"),
    "f18":          Typeable(code=win32con.VK_F18,       name="f18"),
    "f19":          Typeable(code=win32con.VK_F19,       name="f19"),
    "f20":          Typeable(code=win32con.VK_F20,       name="f20"),
    "f21":          Typeable(code=win32con.VK_F21,       name="f21"),
    "f22":          Typeable(code=win32con.VK_F22,       name="f22"),
    "f23":          Typeable(code=win32con.VK_F23,       name="f23"),
    "f24":          Typeable(code=win32con.VK_F24,       name="f24"),

    "alpha":        keyboard.get_typeable(char='a'),
    "a":            keyboard.get_typeable(char='a'),
    "bravo":        keyboard.get_typeable(char='b'),
    "b":            keyboard.get_typeable(char='b'),
    "charlie":      keyboard.get_typeable(char='c'),
    "c":            keyboard.get_typeable(char='c'),
    "delta":        keyboard.get_typeable(char='d'),
    "d":            keyboard.get_typeable(char='d'),
    "echo":         keyboard.get_typeable(char='e'),
    "e":            keyboard.get_typeable(char='e'),
    "foxtrot":      keyboard.get_typeable(char='f'),
    "f":            keyboard.get_typeable(char='f'),
    "golf":         keyboard.get_typeable(char='g'),
    "g":            keyboard.get_typeable(char='g'),
    "hotel":        keyboard.get_typeable(char='h'),
    "h":            keyboard.get_typeable(char='h'),