-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path_personal.py
46 lines (38 loc) · 1.28 KB
/
_personal.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
# Created for aenea using libraries from the Dictation Toolbox
# https://github.com/dictation-toolbox/dragonfly-scripts
#
# Commands for inserting personal details loaded from the config file
#
# Author: Tony Grosinger
#
# Licensed under LGPL
import aenea
import aenea.configuration
from aenea.lax import Function, Text
from aenea import Choice
import dragonfly
from config import get_configuration
vim_context = aenea.ProxyPlatformContext('linux')
generic_grammar = dragonfly.Grammar('generic', context=vim_context)
config = get_configuration()
commands = {}
if "full-name" in config:
commands['my full name'] = Text("%s" % config["full-name"])
if "last-name" in config:
commands['my last name'] = Text("%s" % config["last-name"])
if "first-name" in config:
commands['my first name'] = Text("%s" % config["first-name"])
if "email-address" in config:
commands['my email'] = Text("%s" % config["email-address"])
if "company-name" in config:
commands['company name'] = Text("%s" % config["company-name"])
class Mapping(dragonfly.MappingRule):
mapping = aenea.configuration.make_grammar_commands('personal', commands)
extras = []
generic_grammar.add_rule(Mapping())
generic_grammar.load()
def unload():
global grammar
if grammar:
grammar.unload()
grammar = None