Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     self.spec = _("command <command>")
     self.extras = [
         Alternative(name='command',
                     children=(RuleRef(rule=SimpleCommand()), ))
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     self.spec = _("[<user> at] <server>")
     self.extras = [
         Choice('user', {_("me"): "nihlaeth"}),
         Choice(
             'server', {
                 _("cerridwen"): "cerridwen",
                 _("yemanja"): "yemanja",
                 _("iris"): "iris",
                 _("aine"): "aine",
                 _("dayea"): "dayea",
                 _("brighid"): "brighid",
                 _("freya"): "freya",
                 _("arthemis"): "arthemis",
                 _("morrighan"): "morrighan",
                 _("epona"): "epona",
                 _("athena"): "athena",
                 _("echo"): "echo",
                 _("hera"): "hera",
                 _("hera boot"): "heraboot",
                 _("pele"): "pele",
                 _("eileen"): "eileen",
                 _("inanna"): "inanna.humanity4all.nl",
                 _("anubis"): "anubis.humanity4all.nl",
             })
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 3
0
 def __init__(self, *args, **kwargs):
     self.spec = _('spell <characters>')
     self.extras = [
         Repetition(name='characters',
                    child=RuleRef(rule=AnyCharacter()),
                    min=1,
                    max=80)
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        self.spec = _("<cmds>")
        self.extras = [
            Repetition(name='cmds',
                       child=RuleRef(rule=TrueVimNormalRule()),
                       min=1,
                       max=5)
        ]

        CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     self.spec = _('open process [<cmd>]')
     self.extras = [
         Alternative(name='cmd',
                     children=(
                         RuleRef(name='ssh', rule=SshRule()),
                         RuleRef(name='command', rule=Command()),
                     )),
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 6
0
 def __init__(self, *args, **kwargs):
     self.spec = '<character>'
     self.extras = [
         Alternative(name='character',
                     children=(RuleRef(rule=UppercaseCharacter()),
                               RuleRef(rule=LowercaseCharacter()),
                               RuleRef(rule=Number()),
                               RuleRef(rule=Symbol())))
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     self.spec = _("S S H [<ssh_options>] <server> [<command>]")
     self.extras = [
         Repetition(name='ssh_options',
                    min=0,
                    max=10,
                    child=RuleRef(name='ssh_option', rule=SshOptions())),
         RuleRef(name='server', rule=SshServer()),
         RuleRef(name='command', rule=Command())
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 8
0
    def __init__(self, *args, **kwargs):
        self.spec = _("<cmd>")
        self.extras = [
            Alternative(name='cmd',
                        children=(
                            RuleRef(name='motion_operator',
                                    rule=MotionOperatorRule()),
                            RuleRef(name='motion', rule=MotionRule()),
                            RuleRef(name='normal', rule=VimNormalRule()),
                            RuleRef(name='number', rule=Number()),
                        ))
        ]

        CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 9
0
    def __init__(self, *args, **kwargs):
        self.spec = _("password <name> <passphrase>")
        self.names = List(name='names')
        self.data_path = Path().home().joinpath('speechpass')
        self.data_path.mkdir(exist_ok=True)
        self.language_path = self.data_path.joinpath(
            natlinkstatus.NatlinkStatus().getLanguage())
        self.language_path.mkdir(exist_ok=True)
        for name in self.language_path.iterdir():
            self.names.append(string.replace(name.name, '_', ' '))
        self.extras = [
            ListRef(name='name', list=self.names),
            Dictation(name='passphrase'),
        ]

        CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 10
0
 def __init__(self, *args, **kwargs):
     # technically we should not accept uppercase chars here
     self.spec = _('press [<modifiers>] <character>')
     self.extras = [
         Repetition(name='modifiers',
                    child=Choice(name='modifier',
                                 choices={
                                     _('control'): 'c',
                                     _('shift'): 's',
                                     _('alt'): 'a',
                                     _('(command|super)'): 'w',
                                 }),
                    min=0,
                    max=4),
         RuleRef(name='character', rule=AnyCharacter())
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 11
0
    def __init__(self, *args, **kwargs):
        self.spec = _("<operator> "
                      "(<line>|[to] "
                      "(<motion>|<operatormotion>) "
                      "[<numbers>] "
                      "[<mode> mode])")
        self.extras = [
            Choice(name='operator',
                   choices={
                       _('change'): Key('c'),
                       _('delete'): Key('d'),
                       _('yank'): Key('y'),
                       _('swap case'): Key('g,tilde'),
                       _('make lowercase'): Key('g,u'),
                       _('make uppercase'): Key('g,s-u'),
                       _('filter'): Key('exclamation'),
                       _('C filter'): Key('equal'),
                       _('text formatting'): Key('g,q'),
                       _('rotation 13 encoding'): Key('g,question'),
                       _('shift right'): Key('rangle'),
                       _('shift left'): Key('langle'),
                       _('define fold'): Key('z,f'),
                       _('call function'): 'g,at'
                   }),
            Literal(name='line', text=_('line')),
            Repetition(name='numbers',
                       child=RuleRef(rule=Number()),
                       min=0,
                       max=3),
            RuleRef(name='motion', rule=MotionRule()),
            RuleRef(name='operatormotion', rule=VisualMotionRule()),
            Choice(name='mode',
                   choices={
                       _("character"): Key("v"),
                       _("line"): Key("s-v"),
                       _("block"): Key("c-v"),
                   })
        ]

        CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 12
0
 def __init__(self,
              name=None,
              spec=None,
              extras=None,
              defaults=None,
              exported=False,
              context=None,
              default_formatting='snake'):
     if exported is not None:
         self.exported = exported
     if self.exported:
         self.spec = "<formatting> <dictation>"
     else:
         self.default_formatting = default_formatting
         self.spec = "[<formatting>] <dictation>"
     self.extras = [
         Choice(
             name='formatting',
             choices={
                 _("snake [case]"): "snake",  # snake_case
                 _("camel [case]"): "camel",  # CamelCase
                 _("mixed [case]"): "mixed",  # mixedCase
                 _("upper[case]"): "upper",  # UPPERCASE_STUFF
                 _("no case"): "nocase",  # lowercase text
                 _("sentence"): "sentence",  # Cap first letter
                 _("dictate"): "raw",  # raw dictation
             }),
         Dictation(name='dictation'),
     ]
     CompoundRule.__init__(self,
                           name=name,
                           spec=spec,
                           extras=extras,
                           defaults=defaults,
                           exported=exported,
                           context=context)
Esempio n. 13
0
 def __init__(self, *args, **kwargs):
     self.spec = _("sudo <command>")
     self.extras = [
         RuleRef(name='command', rule=Command()),
     ]
     CompoundRule.__init__(self, *args, **kwargs)
Esempio n. 14
0
 def __init__(self, *args, **kwargs):
     self.spec = _('cap <lowercase_letter>')
     self.extras = [
         RuleRef(name='lowercase_letter', rule=LowercaseCharacter())
     ]
     CompoundRule.__init__(self, *args, **kwargs)