-
Notifications
You must be signed in to change notification settings - Fork 0
/
_global.py
160 lines (143 loc) · 5.67 KB
/
_global.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#imports the library
# from pywinauto.application import Application
from dragonfly import (StartApp, Function, Mimic, Grammar, AppContext, MappingRule, Integer, Key, Text, Dictation, Choice, Pause, Mouse)
# from passes import prod_pass, sand_pass, craig_pass, in_pass
def repeat(number):
for x in range(number):
gitPause(number)
def gitPause(number=0):
p = '20'
Key('f2').execute()
Pause(p).execute()
Key('c-c').execute()
Pause(p).execute()
Key('a-tab').execute()
Pause(p).execute()
Key('c-v').execute()
Pause(p).execute()
Key('enter').execute()
Pause(p).execute()
Key('a-tab').execute()
Pause(p).execute()
Key('down').execute()
Pause(p).execute()
class GlobalMappings(MappingRule):
mapping = {
'move craig <number>': Function(repeat),
'move craig': Function(gitPause),
# Keys
'plus': Key('plus'),
'bat': Key('backspace'),
'bat <number>': Key('backspace:%(number)d'),
'nip': Key('escape'),
'Spat': Key('space'),
'Dink': Key('delete'),
'down': Key('down'),
'find <text>': Key("c-f") + Text("%(text)s"),
'find': Key("c-f"),
'Dunk': Key('s-delete'),
'snap': Key('a-tab'),
'snap hold': Key('alt:down, tab'),
'pick': Key('enter,alt:up'),
'slap': Key('c-tab'),
'down <number>': Key('down:%(number)d'),
# 'up': Key('up'),
'up <number>': Key('up:%(number)d'),
'law': Key("pgup"),
'raw': Key("pgdown"),
'ga': Key("enter"),
'Back tab': Key('s-tab'),
'left [<number>]': Key('left:%(number)d'),
'left dub <number>': Key("ctrl:down, left:%(number)d, ctrl:up"),
'right [<number>]': Key('right:%(number)d'),
'right dub <number>': Key("ctrl:down, right:%(number)d, ctrl:up"),
"cam <camel_text>": Text("%(camel_text)s"),
"snake <snaketext>": Text("%(snaketext)s"),
"low <lowtext>": Text("%(lowtext)s"),
"dash <dashtext>": Text("%(dashtext)s"),
"<snaketext> frame": Text("%(snaketext)s") + Text("_df"),
"dash dash <dashtext>": Key("hyphen") + Text("%(dashtext)s"),
"cal [<pascaltext>]": Text("%(pascaltext)s"),
"title [<titletext>]": Text("%(titletext)s"),
'select down <number>': Key("home, shift:down, down:%(number)d, up, end, shift:up"),
'select up <number>': Key("end, shift:down, up:%(number)d, down, home, shift:up"),
'select right <number>': Key("ctrl:down, shift:down, right:%(number)d, ctrl:up, shift:up"),
'select left <number>': Key("ctrl:down, shift:down, left:%(number)d, ctrl:up, shift:up"),
'select end': Key('s-end'),
'select home': Key('s-home'),
'copy end': Key('s-end,c-c'),
'copy home': Key('s-home, c-c'),
'select all': Key("c-a"),
'copy all': Key("c-a,c-c"),
'line end': Key("end"),
'line end <number>': Key("end") + Key("left:%(number)d"),
'line home': Key("home"),
'line home <number>': Key("home") + Key("right:%(number)d"),
'undo': Key("c-z"),
'undo <number>': Key("c-z:%(number)d"),
'redo ': Key("c-y"),
'redo <number>': Key("c-y:%(number)d"),
'win up': Key('win:down, up, win:up'),
'win right': Key('win:down, right, win:up'),
'win down': Key('win:down, down, win:up'),
'win left': Key('win:down, left, win:up'),
'win search': Key('win:down, s, win:up'),
'win snip': Key('win:down, s-s, win:up'),
'copy': Key('c-c'),
'cut': Key('c-x'),
'paste': Key('c-v'),
'del': Key('del'),
'quote': Key('squote'),
'comma': Key('comma'),
'snooze': Key('csa-slash'),
'snap load': Key('w-4') + Pause("10") + Key('c-1') + Pause("10") + Key('f5') + Pause("10") + Key('a-tab'),
'to files': Key("w-1"),
'to Teams': Key("w-2"),
'to Web': Key("w-3"),
'to py': Key("w-4"),
'to code': Key("w-5"),
# 'to code': Key("win:down, 5, 5, win:up") + Pause('50') + Key("enter"),
'to excel': Key("w-6"),
'to post': Key("w-7"),
'to bricks': Key("w-8"),
'to data': Key("w-9"),
'run it': Key("c-enter"),
##############################
# passwords
##############################
# 'craig pass': Text(craig_pass),
# 'in pass': Text(in_pass),
# 'Prod pass': Text(prod_pass),
# 'Sand pass': Text(sand_pass),
# 'test pass': Text(testy_pass),
'in email': Text("csalzsieder@inspirato.com"),
'in User': Text("csalzsieder"),
# py spark text
'show me': Text('.show()') + Key('enter'),
'count me': Text('.count()') + Key('enter'),
'print schema': Text('.printSchema()') + Key('enter'),
'open dock' : Key('win,s') + Pause('20') + Text('docker') + Pause('20') + Key('enter'),
'[<number>] tab': Key('tab:%(number)d'),
# Temporary
'flag it': Text("# TODO: "),
#postman
'Post run': Key("w-8") + Pause('50') + Key("c-enter") + Pause('50') + Key("a-tab")
}
extras=[
Integer('tab', 1, 10),
Integer('number', 1, 9999),
Dictation("camel_text").camel(),
Dictation("snaketext").lower().replace(" ", "_"),
Dictation("dashtext").lower().replace(" ", "-"),
Dictation("lowtext").lower(),
Dictation("pascaltext").title().replace(" ", ""),
Dictation("titletext").title().replace(" ", " "),
Dictation("text"),
]
grammar=Grammar('Global')
grammar.add_rule(GlobalMappings())
grammar.load()
def unload():
global grammar
if grammar: grammar.unload()
grammar = None