Exemplo n.º 1
0
class CommandRule(MappingRule):
    mapping = {
        #"[go to | show] project window": Key("a-1"),

        # Search.
        "replace": Key("c-h"),
        "show find": Key("c-f"),
        "find <text>": Key("c-f/25") + Text("%(text)s"),
        # "find next": Key("f3"),
        # "find (prev | previous)": Key("s-f3"),
        "find in files": Key("cs-f"),

        # Code.
        "[shoreline | show] line <w> [<x>] [<y>] [<z>]": Key("c-g/25") + Function(printNumber)+ Key("enter"),
        "show white space": Key("cs-w"),
        
        # Window handling.
        "new tab": Key("c-n"),
        "next tab [<t>]": Key("c-tab:%(t)d"),
        "(preev | previous) tab [<t>]": Key("cs-tab:%(t)d"),
        "close tab": Key("c-w"),
        "(full-screen | full screen)": Key("f11"),
    }
    extras = [
        Integer("t", 1, 50),
        Dictation("text"),
        IntegerRef("n", 1, 50000),
        Integer("w", 0, 10),
        Integer("x", 0, 10),
        Integer("y", 0, 10),
        Integer("z", 0, 10)
    ]
    defaults = {
        "t": 1,
    }
Exemplo n.º 2
0
 def __init__(self,
              name=None,
              min=None,
              max=None,
              default=None,
              content=INTEGER_CONTENT):
     Integer.__init__(self, None, min, max, None, content)
Exemplo n.º 3
0
class CommandRule(MappingRule):
    mapping = {
        # Window handling.
        "next tab [<t>]":
        Key("c-tab/40:%(t)d"),
        "(preev | previous) tab [<t>]":
        Key("cs-tab/40:%(t)d"),
        "close tab":
        Key("c-w"),

        # Edit
        "[shoreline | show] line <w> [<x>] [<y>] [<z>]":
        Key("f5/30") + Function(printNumber) + Key("enter, escape"),
    }
    extras = [
        Integer("t", 1, 50),
        Integer("w", 0, 10),
        Integer("x", 0, 10),
        Integer("y", 0, 10),
        Integer("z", 0, 10),
    ]

    defaults = {
        "t": 1,
    }
Exemplo n.º 4
0
class CommandRule(MappingRule):
    mapping = {
        # Window handling.
        "next tab [<t>]":
        Key("c-tab/40:%(t)d"),
        "preev tab [<t>]":
        Key("cs-tab/40:%(t)d"),
        "close tab":
        Key("c-w"),

        # Edit
        "[shoreline | show] line <w> [<x>] [<y>] [<z>]":
        Key("f5/30, s-tab, up:2, down:2, tab") + Function(utils.printNumber) +
        Key("enter, escape"),
        "(shoreline | show | toggle) line numbers":
        Key("cas-l"),
        "hide line numbers":
        Key("cas-k"),
    }
    extras = [
        Integer("t", 1, 50),
        Integer("w", 0, 10),
        Integer("x", 0, 10),
        Integer("y", 0, 10),
        Integer("z", 0, 10),
    ]

    defaults = {
        "t": 1,
    }
class AlternateKeyMap(MappingRule):
    mapping = {
        "wave": Key("shift:up, right"),
        #        "boss": Key("ctrl:down"),
        #        "shun": Key("ctrl:up"),
        "switch": release + Key("ctrl:down, tab"),
        "show apps": release + Key("alt:down, tab"),
        "mimic <text>": release + Mimic(extra="text"),
        "pop": Key("apps"),  # right click
        "list Windows": Mimic("list", "all", "Windows"),

        ### programming
        "short object": Text("obj"),
        "short string": Text("str"),
        "jason": Text("json"),

        ### Dragonfly Commands
        "add text map": Text("\"\": Text(\"\"),") + Key("left:12"),
        "add key map": Text("\"\": Key(\"\"),") + Key("left:11"),
    }
    extras = [
        Integer("n", 1, 50),
        Integer("tab", 1, 8),
        Integer("number", 1, 9999),
        Dictation("text"),
    ]
    defaults = {
        "n": 1,
    }
Exemplo n.º 6
0
class CodeMappings(MappingRule):
    mapping = {}
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 7
0
class CodeMappings(MappingRule):
    mapping = {'test code': Text('cd D:GitProjects')}
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 8
0
class CodeMappings(MappingRule):
    mapping = {
        'tab <number>': Function(calculateSlotNumber),
        'new message': Key('c-n'),
        'send items': Key('c-y, down:2, enter'),
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 9
0
class CodeMappings(MappingRule):
    mapping = {  
            'dock stat': Text('docker ps -a') + Key('enter'),
            'dock rem': Text('docker rm'),
            'dock redis': Text('docker run --name devredis -p 6379:6379 -d redis') + Key('enter'),
            'redis commander': Text('redis-commander') + Key('enter'),
        }
    extras=[
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 10
0
class CodeMappings(MappingRule):
    mapping = {
        'previ': Key('c-pgup'),
        'nexty': Key('c-pgdown'),
        'Run it': Key("f5"),
        'close tab': Key('c-w'),
        'new query': Key('c-n'),
        'line comment': Key("c-k,c-c"),
        'select from': Text("SELECT * FROM")
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 11
0
class TmuxRule(MappingRule):
    mapping = {
        "(connect|attach) [session]":
        Text("tmux attach") + Key("enter"),
        "new (window|tab|shell|terminal)":
        Key("c-b, c"),
        "rename (window|tab|shell|terminal) <text>":
        Key("c-b, comma") + Key("backspace:50") + Text("%(text)s") +
        Key("enter"),
        "rename session <text>":
        Key("c-b, dollar") + Key("backspace:50") + Text("%(text)s") +
        Key("enter"),
        "(window|shell|terminal) <n>":
        Key("c-b, %(n)d"),
        "(disconnect|detach) session":
        Key("c-b, d"),
        "(jump|switch|select|choose) session":
        Key("c-b, w"),
        "switch":
        Key("c-b, w"),
        "switch <n>":
        Key("c-b, %(n)d"),
    }
    extras = [
        Dictation("text"),
        Integer("n", 0, 9),
    ]
Exemplo n.º 12
0
class fluidOne(QuickFluidRules):
    name = "fluid_one"
    mapping = {
        "snarl": Key("space, s, n, a, r, space"),
        "burp": Text(" burpy "),
        "groan": Text("  g r o aaa n  "),
    }
    extras = [
        Integer("n", 1, 50),
        Integer("tab", 1, 8),
        Integer("number", 1, 9999),
        Dictation("text"),
    ]
    defaults = {
        "n": 1,
    }
Exemplo n.º 13
0
class GlobalIntelliJMappings(MappingRule):
    mapping = {
        #ide shortcuts
        "helper": Key("alt:down,enter/5,alt:up"),
        "reformat": Key("ctrl:down, a-l, ctrl:up"),
        "project": Key("ctrl:down, tab:down/10,1/10,tab:up,ctrl:up"),
        "rename": Key("shift:down,f6/10, shift:up"),
        "run": Key("s-f10"),
        "debug": Key("s-f9"),
        "stop": Key("c-f2"),
    }
    extras = [
        Dictation("text"),
        Integer("n", 0, 50),
        Integer("line", 1, 10000)
    ]
Exemplo n.º 14
0
class CompoundTestCCR(CompoundRule):
    spec = "compound testing <text>"
    extras = [
        Integer("t", 1, 50),
        Dictation("text"),
    ]
    defaults = {
        "t": 1,
    }

    def _process_recognition(self, node, extras):
        print "testing the compound: " + extras["text"]

    def value(self, node):
        extras = {
            "_grammar": self.grammar,
            "_rule": self,
            "_node": node,
        }
        extras.update(self.defaults)
        for name, element in self._extras.items():
            extra_node = node.get_child_by_name(name, shallow=True)
            if extra_node:
                extras[name] = extra_node.value()
            elif element.has_default():
                extras[name] = element.default
            #extras[name] = element.value()

        return BoundAction(Function(self._process_recognition), {
            "node": node,
            "extras": extras
        })
Exemplo n.º 15
0
class CommandRule(MappingRule):
    mapping = {
        # Search.
        "replace": Key("c-h"),
        "show find": Key("c-f"),
        "find <text>": Key("c-f/25") + Text("%(text)s"),
        "find next [<n>]": Key("c-g:%(n)d"),
        "find (prev | previous) [<n>]": Key("s-f3:%(n)d"),
        "find (prev | previous)": Key("cs-g"),
        "note find": Key("c-q"),
        "note find <text>": Key("c-q/25") + Text("%(text)s"),

        # Window handling.
        # "new tab": Key("c-n"),
        # "next tab [<t>]": Key("c-tab:%(t)d"),
        # "preev tab [<t>]": Key("cs-tab:%(t)d"),
        # "close tab": Key("c-w"),
        # "(full-screen | full screen)": Key("f11"),
    }
    extras = [
        Integer("t", 1, 50),
        Dictation("text"),
        IntegerRef("n", 1, 50000),
    ]
    defaults = {
        "t": 1,
    }
Exemplo n.º 16
0
class OpenAttachmentRule(CompoundRule):
    spec='open attachment <n>'
    extras=[Integer('n', 1, 10)]
    def _process_recognition(self,node,extras):
        index=extras['n']
        explorer=self.grammar.get_active_explorer()
        if not explorer: return
        if explorer.Selection.Count < 0:
            self._log.warning('%s: no selected, not opening.' % self)
            return
        elif explorer.Selection.Count > 1:
            self._log.warning('%s: multiple items selected, not opening.' % self)
            return
        item=explorer.Selection.Item(1)
        if not (1 <= index <= item.Attachments.Count):
            self._log.warning('%s: attachment index %d of item %r'
                              ' out of range (1 <= index <= %d).'
                              % (self, index, item.Subject, item.Attachments.Count))
            return
        attachment=item.Attachments.Item(index)
        filename=os.path.basename(attachment.FileName)
        temp_dir=tempfile.mkdtemp()
        path=os.path.join(temp_dir,filename)
        attachment.SaveAsFile(path)
        os.startfile(path)
Exemplo n.º 17
0
class MultiMoreKeyMap(MappingRule):
    mapping = {
        "wave":
        Key("shift:up, right"),
        #        "boss": Key("ctrl:down"),
        #        "shun": Key("ctrl:up"),
        "switch":
        release + Key("ctrl:down, tab"),
        "show [all] apps | show [all] Windows":
        release + Key("alt:down, tab"),
        "mimic <text>":
        release + Mimic(extra="text"),
        "pop":
        Key("apps"),  # right click
        "focus chrome too":
        Mimic("focus", "chrome") + Pause("25") + Mimic("focus", "chrome"),

        # Dragon NaturallySpeaking mimics
        "list Windows":
        Mimic("list", "all", "Windows"),
        "(web search | search web) <text>":
        Mimic("search", "the", "web", "for", extra="text"),

        ### programming
        "short object":
        Text("obj"),
        "short string":
        Text("str"),
        "jason":
        Text("json"),

        ### Dragonfly Commands
        "add text map":
        Text("\"\": Text(\"\"),") + Key("left:12"),
        "add key map":
        Text("\"\": Key(\"\"),") + Key("left:11"),
    }
    extras = [
        Integer("n", 1, 50),
        Integer("tab", 1, 8),
        Integer("number", 1, 9999),
        Dictation("text"),
    ]
    defaults = {
        "n": 1,
    }
class CSSValues(MappingRule):
    mapping = {
        "<value> (pixels | pixel)": Text("%(value)dpx"),
        "<value> (points | point)": Text("%(value)dpt"),
    }
    extras = [
        Integer("value", 0, 800),
    ]
Exemplo n.º 19
0
class AnkiMapping(MappingRule):

    mapping = {
        "add card": Key("c-enter"),
    }

    extras = [
        Integer("t", 1, 50),
        Dictation("text"),
        Dictation("text2"),
        IntegerRef("n", 1, 50000),
        Integer("w", 0, 10),
        Integer("x", 0, 10),
        Integer("y", 0, 10),
        Integer("z", 0, 10)
    ]
    defaults = {"t": 1, "text": "", "text2": ""}
Exemplo n.º 20
0
class MappingCountRule(MappingRule):
    exported = False
    extras = [
        NoCompile(Optional(Integer(min=0, max=99), default=1), name='nn'),
        IntegerRef(min=1, max=10, name='n'),
        IntegerRef(min=1, max=100, name='bign'),
        DictateWords('text')
    ]
    defaults = {'n': 1, 'nn': 1, 'text': '', 'bign': 1}
Exemplo n.º 21
0
class TermiteRule(MappingRule):
    mapping = {
        "(bigger|zoom in)": Key("c-plus"),
        "(smaller|zoom out)": Key("c-minus"),
    }
    extras = [
        Dictation("text"),
        Integer("n", 0, 9),
    ]
Exemplo n.º 22
0
class CodeMappings(MappingRule):
    mapping = {
        'tab <number>': Function(calculateSlotNumber),
        'Activity': Key('c-1'),
        'chat': Key('c-2'),
        'Teams': Key('c-3'),
        'Calendar': Key('c-4'),
        'snurch': Key('c-e'),
        'goat': Key('c-g'),
        'Filter': Key('cs-f'),
        'make call': Key('cs-c') + Key('csa-slash'),
        '<text>': Text("%(text)s "),
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
Exemplo n.º 23
0
class GmailMappings(MappingRule):
    mapping = {
        "Gmail find <text>": Key("slash/25") + Text("%(text)s"),
        "Gmail undo": Key("z"),
        "compose": Key("c"),
        "next mail [<n>]": Key("j:%(n)d"),
        "(previous | preev) mail [<n>]": Key("k:%(n)d"),
        "next mess [<n>]": Key("n:%(n)d"),
        "(previous | preev) mess [<n>]": Key("p:%(n)d"),
        "(delete | trash)": Key("hash"),
        "archive": Key("e"),
        "select [and] archive": Key("x,e"),
        "line trash [<n>]": Function(lineTrash),
        "send [and] archive": Mimic("click", "send", "and", "archive"),
        "send (it | mail)": Key("c-enter"),
        "reply": Key("r"),
        "reply [to] all": Key("a"),
        "forward": Key("f"),
        "important": Key("s"),  # star line item
        "select [<n>]": Function(select),
        
        # navigation
        "[go to] inbox": Key("g,i"),
        "[go to] sent mail": Key("g,t"),
        "[go to] drafts": Key("g,d"),
        "[go to] label Indeni": Key("g,l/20") + Text("__Indeni") + Key("enter"),
        
        # move to folders
        "move": Key("v"),
        "move to <text>": Key("x,v/20") + Text("%(text)s") + Key("enter"),
        
        "[move] [to] Indeni": Key("x,v/20") + Text("__Indeni") + Key("enter"),
        "[move] [to] Indeni to do": Key("x,v/20") + Text("__Indeni/todo") + Key("enter"),
        "[move] [to] receipts": Key("x,v/20") + Text("aa_receipts") + Key("enter"),
        "[move] [to] asap": Key("x,v/20") + Text("aa_todo/asap") + Key("enter"),
        "[move] [to] [check back] soon": Key("x,v/20") + Text("aa_todo/check back soon") + Key("enter"),
        "[move] [to] respond": Key("x,v/20") + Text("aa_todo/respond") + Key("enter"),
        "[move] [to] someday": Key("x,v/20") + Text("aa_todo/someday") + Key("enter"),
        "[move] [to] waiting [for response]": Key("x,v/20") + Text("aa_todo/waiting for response") + Key("enter"),
        
        "[move] [to] check me out": Key("x,v/20") + Text("check me out") + Key("enter"),
        "[move] [to] friends": Key("x,v/20") + Text("friends") + Key("enter"),
        "[move] [to] miscellaneous": Key("x,v/20") + Text("miscellaneous") + Key("enter"),
        "[move] [to] mom": Key("x,v/20") + Text("mom") + Key("enter"),
        "[move] [to] notes [to self]": Key("x,v/20") + Text("notes to self") + Key("enter"),
        "[move] [to] trips": Key("x,v/20") + Text("trips") + Key("enter"),
    }

    extras = [
        Dictation("text"),
        Integer("n", 1, 50),
    ]

    defaults = {
        "n": 1,
    }
Exemplo n.º 24
0
class CodeMappings(MappingRule):
    mapping = {
        'send it': Key('c-enter'),
        'sidebar': Key('c-backslash'),
        'line nip': Key('c-slash'),
        'close tab': Key('ca-w'),
        'del line': Key('c-d'),
        'nexti': Key('c-tab'),
        'previ': Key('cs-tab'),
        'Two pain': Key('ca-v'),
        'rename': Key('c-e'),
        'tab <tab>': Key('c-%(tab)d'),
        'save': Key('c-s'),
    }
    extras = [
        Integer('tab', 1, 10),
        Integer('number', 1, 9999),
        Dictation("text")
    ]
class CPPDataTypes(MappingRule):

    mapping = {
        "integer":
        Text("int "),
        "float":
        Text("float "),
        "double":
        Text("double "),
        "boolean":
        Text("bool "),
        "char":
        Text("char "),
        "string":
        Text("string "),
        "long":
        Text("long "),
        "long double":
        Text("long double "),
        "wide character":
        Text("wchar_t "),
        "short":
        Text("short "),
        "constant":
        Text("const "),
        "null":
        Text("NULL"),

        #my attempt at a C++ script for shortcut float notation
        "<n> point <n2> float":
        Text("%(n)d.%(n2)d") + Text("f"),
        "<n> point <n2> <n3> float":
        Text("%(n)d.%(n2)d%(n3)d") + Text("f"),
        "<n> point <n2> <n3> <n4> float":
        Text("%(n)d.%(n2)d%(n3)d%(n4)d") + Text("f"),
    }
    extras = [
        Integer("n", -1000, 1000),
        Integer("n2", 0, 1000),
        Integer("n3", 0, 1000),
        Integer("n4", 0, 1000)
    ]
Exemplo n.º 26
0
class CTLDRule(MappingRule):
    mapping = {
        "load anti (air|airaft) troops": ctld(1, 4),
        "load anti tank troops": ctld(1, 5),
        "load mortar (squad|troops|crew)": ctld(1, 5),
        "unpack crate": ctld(6, 1),
        "drop crate": ctld(6, 2),
    }
    extras = [
        Dictation("text"),
        Integer("n", 0, 9),
    ]
Exemplo n.º 27
0
class GlobalChromeMappings(MappingRule):
    mapping = {
        'close tab': Key('c-w'),
        'open new tab': Key('c-t'),
        'duplicate tab': Key('y/25,t'),  # vimium
        'reopen tab': Key('cs-t'),
        '[go to] next tab': Key('c-pgdown'),
        '[go to] previous tab': Key('c-pgup'),
        'go to tab <tab>': Key('c-%(tab)d'),
        '[go to] first tab': Key('c-1'),
        '[go to] last tab': Key('c-9'),
        'go back': Key('a-left'),
        'go forward': Key('a-right'),
        'go to address': Key('a-d'),
        'reload page': Key('f5'),
        'show labels': Key('f'),  # vimium
        'show labels in new tab': Key('s-f'),  # vimium
        '[go to] label <number>': Text('%(number)d'),  # vimium
        'duplicate tab': Key('y,t'),  # vimium
    }
    extras = [Integer('tab', 1, 8), Integer('number', 1, 9999)]
Exemplo n.º 28
0
class SlackMapping(MappingRule):
    mapping = {
        # "new (thing | tab)": Key("c-t"),
        # "new window": Key("c-n"),
        # "reopen tab": Key("cs-t"),
        # "(next | nex) (tab | ab) [<n>]": Key("c-pgdown:%(n)d"),
        # "(previous | preev) tab [<n>]": Key("c-pgup:%(n)d"),
        # "show tab <tab>": Key("c-%(tab)d"),
        "switch <text>": Key("c-k/25") + Text("%(text)s") + Key("enter"),

        # "open <w> [<x>] [<y>] [<z>]": Key("cs-space/" + click_by_voice_delay) + Function(printNumber) + Key("enter"),  # click by voice
        # "open focus <w> [<x>] [<y>] [<z>]": Key("cs-space/" + click_by_voice_delay) + Function(printNumberFocus) + Key("enter"),  # click by voice
    }
    extras = [
        Integer("n", 1, 50),
        Integer("number", 1, 9999),
        Dictation("text"),
    ]
    defaults = {
        "n": 1,
    }
Exemplo n.º 29
0
class GlobalVSMappings(MappingRule):
    mapping = {
        #ide shortcuts
        "run":
        Key("c-f5"),
        "build":
        Key("f7"),
        "device vector":
        Text("thrust::device_vector<"),
        "thrust":
        Text("thrust::"),
        "(<n>) next tab":
        Key("ctrl:down,alt:down/2,pgdown/2,ctrl:up,alt:up"),
        "reformat":
        Key("c-r") + Key("c-f"),
        "code":
        Key("ctrl:down,alt:down/1,0/1,alt:up,ctrl:up"),
        "output":
        Key("a-2"),
        "rename":
        Key("c-r,r/1"),
        "blast":
        Key("c-r,r/50,end/50,underscore/50,enter/50"),
        "bop":
        Key("c-pgdown"),
        "doc":
        Key("ctrl:down, shift:down/2, d/2, ctrl:up, shift:up"),
        "comment":
        Key("c-k, c-c, escape"),
        "uncomment":
        Key("c-k, c-u, escape"),
        "camel":
        Key("ctrl:down,shift:down/1,k/1,shift:up,ctrl:up,ctrl:down,shift:down/1,c/1,shift:up,ctrl:up"
            ),
    }
    extras = [
        Dictation("text"),
        Integer("n", 0, 50),
        Integer("line", 1, 10000)
    ]
Exemplo n.º 30
0
        def __init__(self, name, min, max, default=None):
            if not settings.settings(
                ["miscellaneous", "short_integer_opt_out"]):
                content = language.ShortIntegerContent
            else:
                content = language.IntegerContent

            if "en" in language.language_map and settings.settings(
                ["miscellaneous", "integer_remap_opt_in"]):
                content.builders[1] = MapIntBuilder(numbers_map_1_to_9())

            element = Integer(None, min, max, content=content)
            RuleWrap.__init__(self, name, element, default=default)