Ejemplo n.º 1
0
 def __init__(self, name):
     Config.__init__(self, name)
     self.cmd = Section("Language section")
     self.cmd.map = Item(
         {"mimic <text>": Mimic(extra="text"), },
         namespace={"Key": Key, "Text":  Text, }
     )
     self.cmd.extras = Item([Dictation("text")])
     self.cmd.defaults = Item({})
Ejemplo n.º 2
0
 def __init__(self, name):
     Config.__init__(self, name)
     self.cmd = Section("Language section")
     self.cmd.map = Item({
         "mimic <text>": Mimic(extra="text"),
     },
                         namespace={
                             "Key": Key,
                             "Text": Text,
                         })
     self.cmd.extras = Item([Dictation("text")])
     self.cmd.defaults = Item({})
Ejemplo n.º 3
0
    def _process_begin(self, executable, title, handle):
        configs = Config.get_instances()

        # Check for modified config files, and if found cause reload.
        new_config_map = {}
        for c in configs:
            new_config_map[c.name] = c
            if not os.path.isfile(c.config_path):
                continue
            config_time = os.path.getmtime(c.config_path)
            module_time = os.path.getmtime(c.module_path)
            if config_time >= module_time:
                print "reloading config",c.name
                os.utime(c.module_path, None)

        # Refresh the mapping of config names -> config files.
        config_map.set(new_config_map)
Ejemplo n.º 4
0
    def _process_begin(self, executable, title, handle):
        configs = Config.get_instances()

        # Check for modified config files, and if found cause reload.
        new_config_map = {}
        for c in configs:
            new_config_map[c.name] = c
            if not os.path.isfile(c.config_path):
                continue
            config_time = os.path.getmtime(c.config_path)
            module_time = os.path.getmtime(c.module_path)
            if config_time >= module_time:  #&gt;= module_time:
                print "reloading config", c.name
                os.utime(c.module_path, None)

        # Refresh the mapping of config names -> config files.
        config_map.set(new_config_map)
Ejemplo n.º 5
0
try:
    import pkg_resources
    pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r81")
except ImportError:
    pass

import os, os.path
from dragonfly import (Grammar, CompoundRule, DictList, DictListRef,
                       MappingRule, Mimic, Key, FocusWindow,
                       Window, Config, Section, Item)


#---------------------------------------------------------------------------
# Set up this module's configuration.

config                   = Config("config manager")
config.lang              = Section("Language section")
config.lang.list_configs = Item("list configs",
                                doc="Command to ...")
config.lang.edit_config  = Item("edit <config> (config | configuration)",
                                doc="Command to ...")
config.lang.show_dragonfly_version = Item("show dragonfly version",
                                doc="Command to ...")
config.lang.update_dragonfly = Item("update dragonfly version",
                                doc="Command to ...")
config.lang.reload_natlink   = Item("reload natlink",
                                doc="Command to ...")
config.load()


#---------------------------------------------------------------------------
 - Say **"upper that"** to convert the selected text to upper case.

"""

# import logging
from dragonfly.windows.clipboard import Clipboard
from dragonfly import Config, Section, Item, Grammar, CompoundRule, Key
from supporting import utils

# rule_log = logging.getLogger("rule")

# ---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("Text Manipulation")
config.tweak = Section("Tweak section")
config.tweak.upper = Item("upper that", doc="Command to convert the selected text to uppercase.")
config.tweak.lower = Item("lower that", doc="Command to convert the selected text to lower case.")
# config.generate_config_file()
config.load()

# ===========================================================================
# Create this module's main grammar object.

grammar = Grammar("text manipulation")


class UpperRule(CompoundRule):
    spec = config.tweak.upper
Ejemplo n.º 7
0
    def bring_it(self):
        target = self.target
        os.startfile(target, self.verb)


class ssh(BringableBase):
    putty_path = r"C:\Program Files\PuTTY\putty"

    def bring_it(self):
        subprocess.Popen([self.putty_path, "-load", self.target])


#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("bring me")
config.targets = Section("Targets section")
config.targets.mapping = Item(
    default={
        "my site": website("http://www.google.com"),
    },
    doc="Mapping of spoken targets to bringable targets.",
    namespace={
        "website": website,
        "open": open,
        "folder": folder,
        "ssh": ssh,
    },
)
config.lang = Section("Language section")
config.lang.bring_me = Item("bring me <target>",
Ejemplo n.º 8
0
from dragonfly import Config, Section, Item

config = Config("gvim")

# What words you wish to use to trigger vim's commands
config.cmd = Section("Language")

# What custom settings does your system have?
config.system = Section("System")
config.system.windowSwitchPrefix = Item(
    'c-',  # default: "c-w,",
    doc=
    "What prefix to use when switching windows? Relevant with vim-tmux-navigator (which can make vim windows and tmux panes inter-navigable.)."
)


def get_config():
    return config
Ejemplo n.º 9
0
        return
    release.execute()
    Key("c-c/3").execute()


def paste_command():
    # Add Command Prompt, putty, ...?
    context = AppContext(executable="console")
    window = Window.get_foreground()
    if context.matches(window.executable, window.title, window.handle):
        return
    release.execute()
    Key("c-v/3").execute()


grammarCfg = Config("multi edit")
grammarCfg.cmd = Section("Language section")
grammarCfg.cmd.map = Item(
    {
        # Navigation keys.
        "up [<n>]": Key("up:%(n)d"),
        "up [<n>] slow": Key("up/15:%(n)d"),
        "down [<n>]": Key("down:%(n)d"),
        "down [<n>] slow": Key("down/15:%(n)d"),
        "left [<n>]": Key("left:%(n)d"),
        "left [<n>] slow": Key("left/15:%(n)d"),
        "right [<n>]": Key("right:%(n)d"),
        "right [<n>] slow": Key("right/15:%(n)d"),
        "page up [<n>]": Key("pgup:%(n)d"),
        "page down [<n>]": Key("pgdown:%(n)d"),
        "up <n> (page|pages)": Key("pgup:%(n)d"),
Ejemplo n.º 10
0
from dragonfly import Config, Section, Item, AppContext, Grammar, MappingRule, IntegerRef, Dictation, Choice, Key, Text

config = Config("HipChat")
config.usernames = Section("Username Mappings")
config.usernames.map = Item(
  {
    "All": "all",
    "Here": "here"
  }
)

config.load()

class NavigationRule(MappingRule):
  mapping = {
    "move up [<n>]":                                    Key("ctrl:down, shift:down, tab:%(n)d, shift:up, ctrl:up"),
    "move down [<n>]":                                  Key("ctrl:down, tab:%(n)d, ctrl:up"),
    "close tab":                                        Key("ctrl:down, f4, ctrl:up"),
    "(join room | private message) <room>":             Key("c-j/25") + Text("%(room)s") + Key("enter"),
    }

  extras = [
    IntegerRef("n", 1, 10),
    Dictation("room"),
    ]

  defaults = {
    "n": 1,
    }

class ChatRule(MappingRule):
Ejemplo n.º 11
0
from dragonfly import Config, Section, Item, MappingRule, Grammar, Dictation, Pause, Function

from lib.dynamic_aenea import (DynamicAction, GlobalDynamicContext, Key, Text)

import lib.format

config = Config("my commands")
config.cmd = Section("helpers")
config.cmd.map = Item({
    "cd (mogo test|mogotest)":
    Text("cd ~/dev/workspaces/mogotest") + Key("enter"),
    "cd (mogo test|mogotest) remote":
    Text("cd ~/dev/workspaces/mogotest-helix") + Key("enter"),
    "cd ping4":
    Text("cd ~/dev/workspaces/ping4app") + Key("enter"),
    "cd ping4 remote":
    Text("cd ~/ping4-helix") + Key("enter"),
    "cd rubber":
    Text("cd ~/dev/workspaces/rubber") + Key("enter"),
    "cd rubber test":
    Text("cd ~/dev/workspaces/rubbertest") + Key("enter"),
    "cd workspaces":
    Text("cd ~/dev/workspaces") + Key("enter"),
    "cd home":
    Text("cd ~") + Key("enter"),
    "cd downloads":
    Text("cd ~/Downloads") + Key("enter"),
    "cd drop box":
    Text("cd ~/Dropbox") + Key("enter"),
    #"cd NatLink": Text("cd C:\NatLink\NatLink\MacroSystem") + Key("enter"),
    "cd NatLink":
Ejemplo n.º 12
0
"""

#import pkg_resources
#pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")

import time
from dragonfly import (Grammar, Alternative, RuleRef, DictListRef,
                       Dictation, Compound, Integer, Rule, CompoundRule,
                       DictList, Window, Rectangle, monitors,
                       Config, Section, Item, FocusWindow, ActionError)


#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("Window control")
config.lang                = Section("Language section")
config.lang.name_win       = Item("name (window | win) <name>",
                                  doc="Command to give the foreground window a name; must contain the <name> extra.")
config.lang.focus_win      = Item("focus <win_selector> | bring <win_selector> to [the] (top | foreground)",
                                  doc="Command to bring a named window to the foreground.")
config.lang.focus_title    = Item("focus title <text>",
                                  doc="Command to bring a window with the given title to the foreground.")
config.lang.translate_win  = Item("place <win_selector> <position> [on <mon_selector>]",
                                  doc="Command to translate a window.")
config.lang.resize_win     = Item("place <win_selector> [from] <position> [to] <position> [on <mon_selector>]",
                                  doc="Command to move and resize a window.")
config.lang.stretch_win    = Item("stretch <win_selector> [to] <position>",
                                  doc="Command to stretch a window.")
config.lang.win_selector   = Item("window | win | [window] <win_names>",
                                  doc="Partial command for specifying a window; must contain the <win_names> extra.")
Ejemplo n.º 13
0
The locking is the same as when the user presses *win-L*.

"""

import pkg_resources

pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")

import ctypes
import natlink
from dragonfly import (Grammar, CompoundRule, Config, Section, Item)

#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("lock screen")
config.lang = Section("Language section")
config.lang.lock_screen = Item("lock screen now now",
                               doc="Command to lock the screen;"
                               " also puts the microphone to sleep.")
config.load()

#---------------------------------------------------------------------------
# Lock screen rule.


class LockRule(CompoundRule):

    spec = config.lang.lock_screen

    def _process_recognition(self, node, extras):
Ejemplo n.º 14
0
from dragonfly import MappingRule, Function, Config, Section, Item


def printTango():
    print "tango"


def printUniform():
    print "uniform"


config = Config("test map")
config.cmd = Section("Command section")
config.cmd.map = Item(
    # Here we define the *default* command map.  If you would like to modify it to your personal taste, please *do not* make changes
    #  here.  Instead change the *config file* called "_multiedit.txt".  If it exists, the map there will replace this one.
    {
        "print tango": Function(printTango),
        "print uniform": Function(printUniform),
    },
    doc=
    "Default window names. Maps spoken-forms to {executable name, title, executable path} dict."
)
config.load()


class TangoMap(MappingRule):
    mapping = config.cmd.map
Ejemplo n.º 15
0
    "squash uppercase": [lib.format.FormatTypes.squash, lib.format.FormatTypes.upperCase],
    "dashify": lib.format.FormatTypes.dashify,
    "lowercase dashify": [lib.format.FormatTypes.dashify, lib.format.FormatTypes.lowerCase],
    "uppercase dashify": [lib.format.FormatTypes.dashify, lib.format.FormatTypes.upperCase],
    "dashify lowercase": [lib.format.FormatTypes.dashify, lib.format.FormatTypes.lowerCase],
    "dashify uppercase": [lib.format.FormatTypes.dashify, lib.format.FormatTypes.upperCase],
    "dotify": lib.format.FormatTypes.dotify,
    "lowercase dotify": [lib.format.FormatTypes.dotify, lib.format.FormatTypes.lowerCase],
    "uppercase dotify": [lib.format.FormatTypes.dotify, lib.format.FormatTypes.upperCase],
    "dotify lowercase": [lib.format.FormatTypes.dotify, lib.format.FormatTypes.lowerCase],
    "dotify uppercase": [lib.format.FormatTypes.dotify, lib.format.FormatTypes.upperCase],
    "say": lib.format.FormatTypes.spokenForm,
    "environment variable": [lib.format.FormatTypes.snakeCase, lib.format.FormatTypes.upperCase],
}

grammarCfg = Config("Intellij Typescript edit")
grammarCfg.cmd = Section("Language section")
grammarCfg.cmd.map = Item(
    {
        # navigation
        # next/prev brace
        # next/prev matching selection
        "down [<n>]": Key("down:%(n)d"),
        "down block": Key("c-rbracket"),
        "down method [<n>]": Key("a-down:%(n)d"),
        "down page [<n>]": Key("pgdown:%(n)d"),

        "doc end": Key("c-end"),
        "doc start": Key("c-home"),

        "go to column <n>": Key("c-g/25") + Text(":%(n)d") + Key("enter"),
Ejemplo n.º 16
0
import os.path
import subprocess
import os
import win32gui
import urllib
#from subprocess import Popen

from dragonfly import (Grammar, ConnectionGrammar, AppContext, CompoundRule,
                       Choice, Window, Config, Section, Item)


#---------------------------------------------------------------------------
# Set up this module's configuration.

config                     = Config("TortoiseSVN")
config.tortoisesvn         = Section("TortoiseSVN configuration")
config.tortoisesvn.path    = Item(r'C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe')
config.tortoisesvn.command = Item("(tortoise | subversion) <command>")
config.tortoisesvn.global_command = Item("(tortoise | subversion) <command> <predef>")
config.tortoisesvn.actions = Item({
                                   "add":         "add",
                                   "checkout":    "checkout",
                                   "commit":      "commit",
                                   "revert":      "revert",
                                   "merge":       "merge",
                                   "delete":      "delete",
                                   "diff":        "diff",
                                   "log":         "log",
                                   "import":      "import",
                                   "update":      "update",
Ejemplo n.º 17
0
from dragonfly import Config, Section, Item, MappingRule, Grammar, Text, Key, Function, Dictation

import lib.format

config = Config("capistrano")
config.cmd = Section("helpers")
config.cmd.map = Item({
    "cap deploy [with] migrations to <text>":
    Text("SKIP_ASSETS=true RUBBER_ENV=") +
    Function(lib.format.lowercase_text) + Text(" cap deploy:migrations"),
    "cap deploy [with] migrations to <text> with filter":
    Text("SKIP_ASSETS=true RUBBER_ENV=") +
    Function(lib.format.lowercase_text) +
    Text(" cap deploy:migrations FILTER="),
    "cap deploy [with] migrations to <text> with filter roles":
    Text("SKIP_ASSETS=true RUBBER_ENV=") +
    Function(lib.format.lowercase_text) +
    Text(" cap deploy:migrations FILTER_ROLES="),
    "cap deploy [with] migrations to <text> with assets":
    Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) +
    Text(" cap deploy:migrations"),
    "cap deploy [with] migrations to <text> with assets with filter":
    Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) +
    Text(" cap deploy:migrations FILTER="),
    "cap deploy [with] migrations to <text> with assets with filter roles":
    Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) +
    Text(" cap deploy:migrations FILTER_ROLES="),
    "cap deploy to <text>":
    Text("SKIP_ASSETS=true RUBBER_ENV=") +
    Function(lib.format.lowercase_text) + Text(" cap deploy"),
    "cap deploy to <text> with filter":
Ejemplo n.º 18
0
#
# With help from:
#  * http://msdn.microsoft.com/en-us/library/ff184607.aspx
#  * http://dragonfly-modules.googlecode.com/svn-history/r50/trunk/command-modules/documentation/mod-_outlook.html
#

from dragonfly import(Config, Section, Item,
                      Grammar, ConnectionGrammar, AppContext,
                      MappingRule, CompoundRule,
                      Key, Integer, IntegerRef,
                      DictList, DictListRef)
import tempfile
import os
import os.path

config = Config('Microsoft Outlook control')
config.lang = Section('Language section')
config.lang.go_to_folder = Item('folder <folder>')
config.lang.move_to_folder = Item('move to <folder>')
config.lang.sync_folders = Item('refresh folders')
config.load()

def collection_iter(collection):
    for index in xrange(1, collection.Count + 1):
        yield collection.Item(index)

class OutlookControlGrammar(ConnectionGrammar):
    def __init__(self):
        self.folders = DictList("folders")
        super(OutlookControlGrammar,self).__init__(
            name="Microsoft Outlook control",
Ejemplo n.º 19
0
in its configuration file.  This is useful for
translations, for example.

"""

import pkg_resources
pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")

from dragonfly import (Grammar, AppContext, MappingRule, Key,
                       Config, Section, Item)


#---------------------------------------------------------------------------
# Initialize this module's configuration.

config = Config("Audacity control")

config.lang                    = Section("Language section")
config.lang.new_project        = Item("[start] new project", doc="Spec starts a new project.")
config.lang.open_project       = Item("open project", doc="Spec opens an existing project.")
config.lang.close_project      = Item("close [this] project", doc="Spec closes currently open project.")
config.lang.save_project       = Item("save [this] project", doc="Spec saves currently open project.")
config.lang.selection_tool     = Item("[open] selection tool", doc="Spec opens the selection tool.")
config.lang.envelope_tool      = Item("[open] envelope tool", doc="Spec opens the envelope tool.")
config.lang.edit_tool          = Item("[open] edit tool", doc="Spec opens the edit tool.")
config.lang.zoom_tool          = Item("[open] zoom tool", doc="Spec opens the zoom tool.")
config.lang.timeshift_tool     = Item("[open] timeshift tool", doc="Spec opens the timeshift tool.")
config.lang.multi_tool         = Item("[open] multi tool", doc="Spec opens the multitool.")
config.lang.next_toolbar_tool  = Item("[move to | go to] next tool", doc="Spec move to the next tool in toolbar.")
config.lang.previous_toolbar_tool = Item("[move to | go to] previous tool", doc="Spec move to the previous tool in toolbar.")
config.lang.silence            = Item("[insert | create] silence", doc="Spec insert silence at current position.")
Ejemplo n.º 20
0
 - Say **"upper that"** to convert the selected text to upper case.

"""

# import logging
from dragonfly.windows.clipboard import Clipboard
from dragonfly import Config, Section, Item, Grammar, CompoundRule, Key
from supporting import utils

# rule_log = logging.getLogger("rule")

# ---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("Text Manipulation")
config.tweak = Section("Tweak section")
config.tweak.upper = Item("upper that", doc="Command to convert the selected text to uppercase.")
config.tweak.lower = Item("lower that", doc="Command to convert the selected text to lower case.")
# config.generate_config_file()
config.load()

# ===========================================================================
# Create this module's main grammar object.

text_manipulation_grammar = Grammar("text manipulation")


class UpperRule(CompoundRule):
    spec = config.tweak.upper
Ejemplo n.º 21
0
        BringableBase.__init__(self, target)
    def bring_it(self):
        target = self.target
		# os.startfile默认程序打开 
        os.startfile(target, self.verb)

class ssh(BringableBase):
    putty_path = r"C:\Program Files\PuTTY\putty"
    def bring_it(self):
        subprocess.Popen([self.putty_path, "-load", self.target])


#---------------------------------------------------------------------------
# Set up this module's configuration.
# _bringme.txt所对应的配置文件 
config = Config("bring me")
config.targets         = Section("Targets section")
config.targets.mapping = Item(
                              default={# 配置文件=>targets.mapping =  
                                       "my site": website("http://www.google.com"),
                                      },
                              doc="Mapping of spoken targets to bringable targets.",
                              namespace={
                                         "website":  website,
                                         "open":     open,
                                         "folder":   folder,
                                         "ssh":      ssh,
                                        },
                             )
config.lang            = Section("Language section")
config.lang.bring_me   = Item("bring me <target>",
Ejemplo n.º 22
0
"""

import os.path
import subprocess
import os
import win32gui
import urllib
#from subprocess import Popen

from dragonfly import (Grammar, ConnectionGrammar, AppContext, CompoundRule,
                       Choice, Window, Config, Section, Item)

#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("TortoiseSVN")
config.tortoisesvn = Section("TortoiseSVN configuration")
config.tortoisesvn.path = Item(
    r'C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe')
config.tortoisesvn.command = Item("(tortoise | subversion) <command>")
config.tortoisesvn.global_command = Item(
    "(tortoise | subversion) <command> <predef>")
config.tortoisesvn.actions = Item(
    {
        "add": "add",
        "checkout": "checkout",
        "commit": "commit",
        "revert": "revert",
        "merge": "merge",
        "delete": "delete",
        "diff": "diff",
Ejemplo n.º 23
0
"""

try:
    import pkg_resources
    pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")
except ImportError:
    pass

from dragonfly import (Grammar, MappingRule, Key, Text, Config)
from lib.text import SCText # this should solve the problem of Text into Virtual box Bash terminal when there is successive for example (( being printed as (9


#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("bash")
config.load()


#---------------------------------------------------------------------------
# Defined this module's main rule.

bash_rule = MappingRule(
    name="bash",
    mapping={
    
            # test bash
             "test bash": Text("this is from Text: :: ;; (( )) (((()))))") + SCText("this is from SCText: :: ;; (( )) (((()))))"),
             
            # terminal  
             "[keyboard] break": Key("c-c"),
Ejemplo n.º 24
0
from dragonfly import (Grammar, CompoundRule, Config, Section, Item)

import natlink

config = Config("snore");
config.lang = Section("Language section");
config.lang.snore = Item("snore", doc="Put the microphone to sleep")

class SnoreRule(CompoundRule):

  spec = config.lang.snore
  
  def _process_recognition(self, node, extras):
    self._log.debug("sleepy mic")
    natlink.setMicState("sleeping")

grammar = Grammar("snore")
grammar.add_rule(SnoreRule())
grammar.load()

def unload():
  global grammar
  if grammar: grammar.unload()
  grammar = None
Ejemplo n.º 25
0
"""

try:
    import pkg_resources
    pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")
except ImportError:
    pass

from dragonfly import (Grammar, AppContext, MappingRule, Dictation,
                       Key, Text, Config, Section, Item, IntegerRef)


#---------------------------------------------------------------------------
# Set up this module's configuration.

config                             = Config("Foxit reader control")
config.lang                        = Section("Language section")
config.lang.new_win                = Item("new (window | win)")
#config.generate_config_file()
config.load()


#---------------------------------------------------------------------------
# Create the main command rule.

class CommandRule(MappingRule):

    mapping  = {
                "zoom in [<n>]":            Key("c-equals:%(n)d"),
                "zoom out [<n>]":           Key("c-hyphen:%(n)d"),
                "zoom [one] hundred":       Key("c-1"),
Ejemplo n.º 26
0
from dragonfly import Config, Section, Item, MappingRule, Grammar, Text, Key, Function, Dictation

import lib.format

config = Config("capistrano")
config.cmd = Section("helpers")
config.cmd.map = Item(
    {
        "cap deploy [with] migrations to <text>": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations"),
        "cap deploy [with] migrations to <text> with filter": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations FILTER="),
        "cap deploy [with] migrations to <text> with filter roles": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations FILTER_ROLES="),
        "cap deploy [with] migrations to <text> with assets": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations"),
        "cap deploy [with] migrations to <text> with assets with filter": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations FILTER="),
        "cap deploy [with] migrations to <text> with assets with filter roles": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy:migrations FILTER_ROLES="),

        "cap deploy to <text>": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy"),
        "cap deploy to <text> with filter": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy FILTER="),
        "cap deploy to <text> with filter roles": Text("SKIP_ASSETS=true RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy FILTER_ROLES="),
        "cap deploy to <text> with assets": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy"),
        "cap deploy to <text> with assets with filter": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy FILTER="),
        "cap deploy to <text> with assets with filter roles": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap deploy FILTER_ROLES="),

        "cap invoke to <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap invoke COMMAND=\"\"") + Key("left:1"),
        "cap invoke to <text> with filter": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap invoke COMMAND=\"\" FILTER="),
        "cap invoke to <text> with filter roles": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap invoke COMMAND=\"\" FILTER_ROLES="),

        "cap rubber reboot <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap rubber:reboot ALIAS=") + Function(lib.format.lowercase_text),
        "cap rubber bootstrap <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap rubber:bootstrap FILTER=") + Function(lib.format.lowercase_text),
        "cap rubber set up security groups <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap rubber:setup_security_groups FILTER=") + Function(lib.format.lowercase_text),
        "cap rubber set up local aliases <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap rubber:setup_local_aliases"),
        "cap rubber set up remote aliases <text>": Text("RUBBER_ENV=") + Function(lib.format.lowercase_text) + Text(" cap rubber:setup_remote_aliases"),
Ejemplo n.º 27
0
try:
    import pkg_resources
    pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r81")
except ImportError:
    pass

import os, os.path
from dragonfly import (Grammar, CompoundRule, DictList, DictListRef,
                       MappingRule, Mimic, Key, FocusWindow, Window, Config,
                       Section, Item)

#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("config manager")
config.lang = Section("Language section")
config.lang.list_configs = Item("list configs", doc="Command to ...")
config.lang.edit_config = Item("edit <config> (config | configuration)",
                               doc="Command to ...")
config.lang.show_dragonfly_version = Item("show dragonfly version",
                                          doc="Command to ...")
config.lang.update_dragonfly = Item("update dragonfly version",
                                    doc="Command to ...")
config.lang.reload_natlink = Item("reload natlink", doc="Command to ...")
config.load()

#---------------------------------------------------------------------------

config_map = DictList("config_map")
Ejemplo n.º 28
0
-----------------------------------------------------------------------------
Licensed under the LGPL3.

"""

from dragonfly import Config, Section, Item, AppContext, Grammar, MappingRule, IntegerRef, Dictation, Choice

from lib.dynamic_aenea import (
    DynamicContext,
    Key,
    Text,
)

from proxy_nicknames import AppContext as NixAppContext

hipchat_config = Config("HipChat")
hipchat_config.usernames = Section("Username Mappings")
hipchat_config.usernames.map = Item({"All": "all", "Here": "here"})

hipchat_config.load()


class NavigationRule(MappingRule):
    mapping = {
        "move up [<n>]":
        Key("cs-tab:%(n)d"),
        "move down [<n>]":
        Key("c-tab:%(n)d"),
        "close tab":
        Key("c-w"),
        "(join room | private message) <room>":
Ejemplo n.º 29
0
import pkg_resources
pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")

import os.path
from win32com.client  import Dispatch
from pywintypes       import com_error

from dragonfly import (ConnectionGrammar, AppContext, DictListRef,
                       CompoundRule, DictList, Config, Section, Item)


#---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("Microsoft Word styles control")
config.lang                = Section("Language section")
config.lang.set_style      = Item("set style <style>", doc="Spec for setting a style; must contain the <style> extra.")
config.lang.update_styles  = Item("(update | synchronize) styles", doc="Spec for updating style list.")
#config.generate_config_file()
config.load()


#---------------------------------------------------------------------------
# StyleRule which keeps track of and can set available styles.

class StyleRule(CompoundRule):

    spec   = config.lang.set_style
    styles = DictList("styles")
    extras = [DictListRef("style", styles)]
Ejemplo n.º 30
0
"""

# import pkg_resources
# pkg_resources.require("dragonfly >= 0.6.5beta1.dev-r76")

import time
from dragonfly import (Grammar, Alternative, RuleRef, DictListRef,
                       Dictation, Compound, Integer, Rule, CompoundRule,
                       DictList, Window, Rectangle, monitors,
                       Config, Section, Item, FocusWindow, ActionError)


# ---------------------------------------------------------------------------
# Set up this module's configuration.

config = Config("Window control")
config.lang = Section("Language section")
config.lang.name_win = Item(
    "name (window | win) <name>",
    doc="Command to give the foreground window a name; must contain the <name> extra.")
config.lang.focus_win = Item(
    "focus <win_selector> | bring <win_selector> to [the] (top | foreground)",
    doc="Command to bring a named window to the foreground.")
config.lang.focus_title = Item(
    "focus title <text>",
    doc="Command to bring a window with the given title to the foreground.")
config.lang.translate_win = Item(
    "place <win_selector> <position> [on <mon_selector>]",
    doc="Command to translate a window.")
config.lang.resize_win = Item(
    "place <win_selector> [from] <position> [to] <position> [on <mon_selector>]",
Ejemplo n.º 31
0
from dragonfly import (Grammar, CompoundRule, Config, Section, Item)

import natlink

config = Config("snore")
config.lang = Section("Language section")
config.lang.snore = Item("snore", doc="Put the microphone to sleep")


class SnoreRule(CompoundRule):

    spec = config.lang.snore

    def _process_recognition(self, node, extras):
        self._log.debug("sleepy mic")
        natlink.setMicState("sleeping")


grammar = Grammar("snore")
grammar.add_rule(SnoreRule())
grammar.load()


def unload():
    global grammar
    if grammar: grammar.unload()
    grammar = None
Ejemplo n.º 32
0
    'F six': 'f6',
    'F seven': 'f7',
    'F eight': 'f8',
    'F nine': 'f9',
    'F ten': 'f10',
    'F eleven': 'f11',
    'F twelve': 'f12',
}

pressKeyMap = {}
pressKeyMap.update(letterMap)
pressKeyMap.update(numberMap)
pressKeyMap.update(controlKeyMap)
pressKeyMap.update(functionKeyMap)

grammarCfg = Config("multi edit")
grammarCfg.cmd = Section("Language section")
grammarCfg.cmd.map = Item(
    {
        # Navigation keys.
        "up [<n>]":
        Key("up:%(n)d"),
        "down [<n>]":
        Key("down:%(n)d"),
        "left [<n>]":
        Key("left:%(n)d"),
        "right [<n>]":
        Key("right:%(n)d"),
        "page up [<n>]":
        Key("pgup:%(n)d"),
        "page down [<n>]":
Ejemplo n.º 33
0
from dragonfly import Function, MappingRule, Text, Dictation, Config, Section, Item, Key

config = Config("format functions")
config.cmd = Section("Command section")
config.cmd.map = Item(
    {},
    namespace={
        "Key": Key,
        "Text": Text,
    }
)
namespace = config.load()


#---------------------------------------------------------------------------
# Here we prepare the list of formatting functions from the config file.

# Retrieve text-formatting functions from this module's config file. Each of these functions must have a name that starts with "format_".
format_functions = {}
if namespace:
    for name, function in namespace.items():
        if name.startswith("format_") and callable(function):
            spoken_form = function.__doc__.strip()

            # We wrap generation of the Function action in a function so that its *function* variable will be local.  Otherwise it
            #  would change during the next iteration of the namespace loop.
            def wrap_function(function):
                def _function(dictation):
                    formatted_text = function(dictation)
                    Text(formatted_text).execute()
Ejemplo n.º 34
0
-----------------------------------------------------------------------------
Licensed under the LGPL3.

"""

from dragonfly import Config, Section, Item, AppContext, Grammar, MappingRule, IntegerRef, Dictation, Choice

from lib.dynamic_aenea import (
    DynamicContext,
    Key,
    Text,
)

from aenea.proxy_contexts import ProxyAppContext as NixAppContext

hipchat_config = Config("HipChat")
hipchat_config.usernames = Section("Username Mappings")
hipchat_config.usernames.map = Item(
    {
        "All": "all",
        "Here": "here"
    }
)

hipchat_config.load()

class NavigationRule(MappingRule):
    mapping = {
        "move up [<n>]":                                    Key("cs-tab:%(n)d"),
        "move down [<n>]":                                  Key("c-tab:%(n)d"),
        "close tab":                                        Key("c-w"),
Ejemplo n.º 35
0
#grammar = Grammar("Dynamic manager", context=None)
grammar = DynamicManagerGrammar()
grammar.add_rule(series_rule)
grammar.load()


notify()  # Notify that Dragonfly is ready with a sound.


def unload():
    """Unload function which will be called at unload time."""
    # Unload the dynamically loaded modules.
    global moduleMapping
    for module in moduleMapping.values():
        print "---------- " + __file__.split('\\')[-1] + " unload(): " + str(module.__name__)
        module.unload()

    global grammar
    if grammar:
        grammar.unload()
    grammar = None

#---------------------------------------------------------------------------
# Set up this module's configuration. In this module's particular case, this doesn't necessarily make alot of sense, as this file/module is not expected to be edited every day, and it doesn't have/need a config file ie .txt, but having this make it easier to bring this module into notepad via _dragonfly_tools.py/config manager "edit dynamic manager module" command
# may be should combine dynamics/*.py into one _dragonfly_tools.txt config file, so that on editing the config file the the main .py module gets touced (via a method in _dragonfly_tools.py) and cause it to reload (even thought this reload is not reliable and sometimes needs sleep/wakeup or microphoneOff/microphoneOn to properly reload the newly edited moudle and it's config)
# alternatively re-employ the method/function of _dragonfly_tools.py that touches the .py when .txt is edited, to make it re-touch _dynamic_manager.py when any of dynamics/*.py is edited

from dragonfly import Config
dragonfly_config = Config("dynamic manager") # config is already used for lib/config.py's config.json file
dragonfly_config.load()