当前位置: 首页>>代码示例>>Python>>正文


Python dragonfly.Config类代码示例

本文整理汇总了Python中dragonfly.Config的典型用法代码示例。如果您正苦于以下问题:Python Config类的具体用法?Python Config怎么用?Python Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Config类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 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({})
开发者ID:Solar-Plexus,项目名称:caster,代码行数:9,代码来源:devgen.py

示例2: _process_begin

    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)
开发者ID:Erotemic,项目名称:local,代码行数:17,代码来源:_dragonfly_tools.py

示例3: import

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()


#---------------------------------------------------------------------------
开发者ID:Erotemic,项目名称:local,代码行数:31,代码来源:_dragonfly_tools.py

示例4: Config

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"),
开发者ID:taylor-brown,项目名称:dragonfly-scripts,代码行数:31,代码来源:_capistrano.py

示例5: Config

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):
开发者ID:taylor-brown,项目名称:dragonfly-scripts,代码行数:31,代码来源:_hipchat.py

示例6: import

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
开发者ID:latviancoder,项目名称:dragonfly-scripts,代码行数:24,代码来源:_snore.py

示例7: Key

        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"),
开发者ID:1nsp1r3rnzt,项目名称:dragonfly-scripts,代码行数:31,代码来源:_generic_edit.py

示例8: import

"""

#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.")
开发者ID:taylor-brown,项目名称:dragonfly-scripts,代码行数:31,代码来源:_winctrl.py

示例9: import

-----------------------------------------------------------------------------
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"),
开发者ID:1nsp1r3rnzt,项目名称:dragonfly-scripts,代码行数:31,代码来源:_app_hipchat.py

示例10: bring_it

        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>",
开发者ID:jiqimaogou,项目名称:Dragonfly-commands,代码行数:31,代码来源:_bringme.py

示例11: import

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",
开发者ID:Anhmike,项目名称:dragonfly-modules,代码行数:30,代码来源:_tortoisesvn.py

示例12: Config

 - 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
开发者ID:haughki,项目名称:MyDragonflyModules,代码行数:29,代码来源:_text_manipulation.py


注:本文中的dragonfly.Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。