Esempio n. 1
0
 def __init__(self,
              data,
              lower=True,
              capitalCheck=True,
              spaceCheck=True,
              allCaps=False):
     Text.__init__(self, data, lower=lower)
     self.capitalCheck = capitalCheck and not allCaps
     self.spaceCheck = spaceCheck
     self.allCaps = allCaps
Esempio n. 2
0
 def _print(self, words):
     # There's no good elisp way to handle putting characters into
     # the search box AFAIK. You can get text in there but giving it
     # focus disables search as you type.
     inSearchMode = runEmacsCmd("isearch-mode") != 'nil'
     inMiniBuffer = '*Minibuf-' in runEmacsCmd("(with-current-buffer (buffer-name))")
     words = words if not self.allCaps else [i.upper() for i in words]
     if inSearchMode or inMiniBuffer:
         Text._print(self, words)
     else:
         runEmacsCmd("(md-insert-text \"%s\" %s %s)" % (words, emacsBool(self.spaceCheck),
                     emacsBool(self.capitalCheck)), dolog=True,
                     queryOnly=False)
Esempio n. 3
0
 def _print(self, words):
     # There's no good elisp way to handle putting characters into
     # the search box AFAIK. You can get text in there but giving it
     # focus disables search as you type.
     inSearchMode = runEmacsCmd("isearch-mode") != 'nil'
     inMiniBuffer = '*Minibuf-' in runEmacsCmd(
         "(with-current-buffer (buffer-name))")
     words = words if not self.allCaps else [i.upper() for i in words]
     if inSearchMode or inMiniBuffer:
         Text._print(self, words)
     else:
         runEmacsCmd("(md-insert-text \"%s\" %s %s)" %
                     (words, emacsBool(
                         self.spaceCheck), emacsBool(self.capitalCheck)),
                     dolog=True,
                     queryOnly=False)
Esempio n. 4
0
 def __call__(self, extras={}):
     text = self.data
     if self.data:
         text += " "
     # go to address bar, deleting existing text
     (Key("c-l, c-a, backspace")
      # enter the text
      + Text(text + (" %(text)s"))
      # delete any autocomplete results off the end and enter
      + Key("delete, enter"))(extras)
Esempio n. 5
0
    def __call__(self, extras={}):
#        Key("a-x")()
        Key("c-c,m,x")() # guaranteed to not use helm
        Text(self.data % extras)()
        Key("enter")()
Esempio n. 6
0
    "axe": Key("escape"),
    "find": Key("c-f"),
    "find it next [<n>]": Key("F3:%(n)d"),
    "find it previous [<n>]": Key("s-F3:%(n)d"),
    "leaf [<n>]": Key("pgdown:%(n)d"),
    "feel [<n>]": Key("pgup:%(n)d"),
    "home": Key("home"),
    "edge": Key("end"),
    "left [<n>]": Key("left:%(n)d"),
    "right [<n>]": Key("right:%(n)d"),
    "hike [<n>]": Key("up:%(n)d"),
    "slide [<n>]": Key("down:%(n)d"),
    "bonk [<n>]": Key("delete:%(n)d"),
    "knock [<n>]": Key("backspace:%(n)d"),
    "slap [<n>]": Key("enter:%(n)d"),
    "num <big>": Text("%(big)d"),
    "per [<n>]": Key("c-left:%(n)d"),
    "pro [<n>]": Key("c-right:%(n)d"),
    "chip [<n>]": Key("c-backspace:%(n)d"),
    "pitch [<n>]": Key("c-delete:%(n)d"),
    "top side": Key("c-home"),
    "bottom": Key("c-end"),
    "save file": Key("c-s"),
    "open file": Key("c-o"),
    "new file": Key("c-n"),

    # Also in the emacs rules, but since emacs rules are mutually exclusive with these
    # both definition should never be active at the same time.
    "view <charrule>": CharCmd("(md-select-window-with-glyph %s)"),
}
Esempio n. 7
0
from requirements.Emacs import NotEmacs
from EventList import RuleActivateEvent
import string
from protocol import Integer, Dictation, RuleRef, Repetition, RuleType


# class PrintLetter(object):
#     def __call__(self, extras):
#         log.info("Heard letter! %s" % extras['words'])

_mapping = {
    'rep [<n>]'                              : RepeatPreviousAction(),
    "[control] [alt] [sky] <charrule> [<i>]" : PressKey(),
    'scoot [<i>]'                            : Key("tab:%(i)d"),
    'cap scoot [<i>]'                        : Key("s-tab:%(i)d"),
    'greek alpha' : Text("alpha"),
    'greek alphas' : Text("alphas"),
    "click left" : click(1),
    "click middle" : click(2),
    "click right" : click(3)
}

_extras = [
    Integer("i", 3, 8),
    Integer("n", 3, 72),
    Integer("digit", 0, 10),
    Dictation("text"),
    RuleRef(AlphaRule, "alpharule"),
    RuleRef(CharRule, "charrule"),
]
Esempio n. 8
0
 def __init__(self, data, lower=True, capitalCheck=True, spaceCheck=True,
              allCaps=False):
     Text.__init__(self, data, lower=lower)
     self.capitalCheck = capitalCheck and not allCaps
     self.spaceCheck = spaceCheck 
     self.allCaps = allCaps
Esempio n. 9
0
    "demagnify [<i>]": Key("c-minus:%(i)d"),
    "axe [<n>]": Key("c-g:%(n)d"),
    "left [<n>]": Key("left:%(n)d"),
    "right [<n>]": Key("right:%(n)d"),
    "hike [<n>]": Key("up:%(n)d"),
    "slide [<n>]": Key("down:%(n)d"),
    "kill [<n>]": Key('c-k:%(n)d'),
    "bonk [<n>]": Key("delete:%(n)d"),
    "knock [<n>]": Key("backspace:%(n)d"),
    "slap [<n>]": Key("enter:%(n)d"),
    "history": Key("c-r"),
    "background": Key("c-z"),
    "interrupt": Key("c-c,c-c"),
    "chip [<n>]": Key("c-w:%(n)d"),
    "pitch [<n>]": Key("a-d:%(n)d"),
    "run top": Text("top") + Key("enter"),
    "run H top": Text("htop") + Key("enter"),
    "switch user": Text("su - "),
    "C D": Text("cd "),
    "run D message": Text("dmesg") + Key("enter"),
    "S S H": Text("ssh "),
    # Also in the emacs rules, but since emacs rules are mutually exclusive with these
    # both definition should never be active at the same time.
    "view <charrule>": CharCmd("(md-select-window-with-glyph %s)"),
}

_extras = [
    Dictation("text"),
    Integer("n", 3, 20),
    Integer("i", 3, 8),
]