Example #1
0
def pauseDragon():
    print "Pausing Dragon"
    logRecognition("pause")
    # Pause Dragon, similar to saying "Stop Listening"
    action = dragonfly.Key("npdiv")  # Numpad "/" key
    action.execute()

    # Also pause my music player
    #action = aenea.Key("ctrl:down, shift:down, f12") + aenea.Key("ctrl:up, shift:up")
    #action.execute()
    pid = aenea.communications.server.controlMusic("pause")
Example #2
0
 def right(self, n=1):
     dragonfly.Key("right:{}".format(n)).execute()
Example #3
0
 def left(self, n=1):
     dragonfly.Key("left:{}".format(n)).execute()
Example #4
0
 def shift_up(self):
     dragonfly.Key("shift:up").execute()
Example #5
0
 def shift_down(self):
     dragonfly.Key("shift:down").execute()
Example #6
0
 def __init__(self, spec):
     proxy = aenea.proxy_actions.ProxyKey(spec)
     local = dragonfly.Key(spec)
     AeneaDynStrActionBase.__init__(self, proxy, local, spec, '%'
                                    not in spec)
 def build(self, call_info):
     spec = _get_single_anon_string(call_info.arguments, "Key action")
     return dragonfly.Key(spec)
Example #8
0
 def __init__(self, spec=None, static=False):
     DynamicAction.__init__(self, dragonfly.Key(spec, static),
                            aenea.ProxyKey(spec, static))
Example #9
0
import dragonfly as fly
from _crall_dragonfly import Template
from _python_templates import func_tfmt, class_tfmt, listcomp_fmt

python_mapping = {
    'F. M. T.': fly.Text('fmt'),
    'P. Y.': fly.Text('py'),
    'N. P.': fly.Text('np'),
    'P. D.': fly.Text('pd'),
    'triple quote': fly.Text('\'\'\'') + fly.Key('enter') + fly.Text('\'\'\''),
    'is instance' : fly.Text('isinstance'),
    'U. tool' : fly.Text('utool'),
    'I. python' : fly.Text('ipython'),


    'from' : fly.Text('from '),
    'import' : fly.Text('import '),
    'lambda' : fly.Text('lambda '),
    'zip' : fly.Text('zip'),
    'map' : fly.Text('map'),

    #'import <mod>' : fly.Text('import /%(mod)s'),
    #'import <mod> as <alias>' : fly.Text('import /%(mod)s as /%(alias)s'),

    # common phrases

    'no Q. A.': fly.Text('  # NOQA'),

    # python structures

    'make def'    : Template(func_tfmt),
Example #10
0
def Release(*keys):
    #return fly.Key(', '.join([key + ':up' for key in keys]))
    key_iter = (fly.Key(key + ':up') for key in keys)
    return MultiAction(key_iter)
Example #11
0
def Hold(*keys):
    #return fly.Key(', '.join([key + ':down' for key in keys]))
    key_iter = (fly.Key(key + ':down') for key in keys)
    return MultiAction(key_iter)
Example #12
0
    for next_action in action_iter:
        action += next_action
    return action


def Hold(*keys):
    #return fly.Key(', '.join([key + ':down' for key in keys]))
    key_iter = (fly.Key(key + ':down') for key in keys)
    return MultiAction(key_iter)


def Release(*keys):
    #return fly.Key(', '.join([key + ':up' for key in keys]))
    key_iter = (fly.Key(key + ':up') for key in keys)
    return MultiAction(key_iter)


def CtrlAlt(action):
    return Hold('ctrl', 'alt') + action + Release('ctrl', 'alt')


def CtrlShift(action):
    return Hold('ctrl', 'shift') + action + Release('ctrl', 'shift')


def Template(fmt):
    return fly.Text(fmt)

release = Release('shift', 'ctrl')  # Key('shift:up, ctrl:up')
esc = fly.Key('escape')
Example #13
0
    'cache',
    'dir',
]

words = {
    #'hots': fly.Text('hots'),
    'ibeis | ibis': fly.Text('ibeis'),
    'vim': fly.Text('vim'),
    'G. vim': fly.Text('gvim'),
    'pandas': fly.Text('pandas'),
    'notebook': fly.Text('notebook'),
    #'esc | ask': fly.Text('esc'),
}

terminal = {
    'lips | L. S.': fly.Text('ls') + fly.Key('enter'),
}

_git = '(get | git)'
_git = 'git'
git = {
    _git + ' move': fly.Text('git move'),
    _git + ' status': fly.Text('git status'),
    _git + ' add': fly.Text('git add '),
    _git + ' commit': fly.Text('git commit -am ""') + fly.Key('left'),
    _git + ' push': fly.Text('git push'),
    _git + ' pull': fly.Text('git pull'),
    'G.G.P.': fly.Text('ggp'),
    'G.G.S.': fly.Text('ggs'),
    'G.C. wip': fly.Text('gcwip'),
}
Example #14
0
from _crall_dragonfly import esc  # NOQA
import dragonfly as fly
# https://pythonhosted.org/dragonfly/actions.html#refkeyspecnames
key_mapping = {
    'A. | a': fly.Key('a'),
    'B.': fly.Text('b'),
    'C.': fly.Text('c'),
    'I.': fly.Text('i'),
    'J.': fly.Text('j'),
    'K.': fly.Text('k'),
    'F.': fly.Text('f'),
    'O. | oh | o ': fly.Text('o'),
    'R. ': fly.Text('r'),
    'W. ': fly.Text('w'),
    'Q. ': fly.Text('q'),
    'X. ': fly.Text('x'),
}

symbol_mapping = {
    'pipe': fly.Text('|'),
    'plus': fly.Text('+'),
    'minus': fly.Text('-'),
    'score': fly.Text('_'),
    'equals': fly.Text('='),
    'care': fly.Text('^'),
    #conflict dot 'doll'              : fly.Text('$'),
    'star | asterisk': fly.Text('*'),
    'comma': fly.Text(','),
    'percent': fly.Text('%%'),
    'slash': fly.Text('/'),
    'backslash': fly.Text('\\'),