예제 #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({})
예제 #2
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")

#---------------------------------------------------------------------------
예제 #3
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.")
예제 #4
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
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>":
        Key("c-j/25") + Text("%(room)s") + Key("enter"),
예제 #6
0
        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>",
                            doc="Command to bring a target;"
예제 #7
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

    def _process_recognition(self, node, extras):
예제 #8
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",
            context=AppContext(executable="outlook"),
예제 #9
0
    '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>]":
        Key("pgdown:%(n)d"),
예제 #10
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":
예제 #11
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
예제 #12
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",