예제 #1
0
 def __init__(self, base, rspec="default", rdescript=None, rundo=None):
     ActionBase.__init__(self)
     self.state = control.nexus().state
     self.base = base
     self.rspec = rspec
     self.rdescript = rdescript
     self.rundo = rundo
예제 #2
0
    def __init__(self, *args, **kwargs):
        """
            Constructor arguments:
             - *args* (variable argument list of *str*'s) --
               these strings are passed to subprocess.Popen()
               to start the application as a child process
             - *cwd* (*str*, default *None*) --
               if not *None*, then start the application in this
               directory
    
        """
        ActionBase.__init__(self)
        self._args = args

        if "cwd" in kwargs:
            self._cwd = kwargs.pop("cwd")
        else:
            self._cwd = None
            
        if kwargs:
            raise ArgumentError("Invalid keyword arguments: %r" % kwargs)

        # Expand any variables within path names.
        self._args = [self._interpret(a) for a in self._args]
        if self._cwd:
            self._cwd = self._interpret(self._cwd)

        self._str = str(", ".join(repr(a) for a in self._args))
예제 #3
0
 def __init__(self, base, rspec="default", rdescript="unnamed command (RA)", rundo=None, show=True):
     ActionBase.__init__(self)
     self._nexus = None
     self.base = base
     self.rspec = rspec
     self.rdescript = rdescript
     self.rundo = rundo
     self.show = show
예제 #4
0
 def __init__(self, execname, winname = None, timeout = 5.0):
     ActionBase.__init__(self)
     self.execname = execname
     if winname == None:
         self.winname = execname
     else:
         self.winname = winname
     self.timeout = timeout
예제 #5
0
 def __init__(self, base, rspec="default", rdescript="unnamed command (RA)", 
              rundo=None, show=True):
     ActionBase.__init__(self)
     self.state = control.nexus().state
     self.base = base
     self.rspec = rspec
     self.rdescript = rdescript
     self.rundo = rundo
     self.show = show
예제 #6
0
파일: additions.py 프로젝트: seekM/caster
 def __init__(self, action, executables, negate=True):
     '''
     action: another Dragonfly action
     executables: an array of strings, each of which is the name of an executable
     negate: if True, the action should not occur during any of the listed executables, if false the opposite
     '''
     ActionBase.__init__(self)
     self.action = action
     self.executables = executables
     self.negate = negate
예제 #7
0
 def __init__(self, action, executables, negate=True):
     '''
     action: another Dragonfly action
     executables: an array of strings, each of which is the name of an executable
     negate: if True, the action should not occur during any of the listed executables, if false the opposite
     '''
     ActionBase.__init__(self)
     self.action = action
     self.executables = executables
     self.negate = negate
예제 #8
0
 def __init__(self, proxy_action, local_action):
     '''proxy_action and remote_action may be dragonfly.ActionBase
         subclasses or callables.'''
     assert (hasattr(proxy_action, 'execute')
             or hasattr(proxy_action, '__call__'))
     assert (hasattr(local_action, 'execute')
             or hasattr(local_action, '__call__'))
     self._proxy_action = proxy_action
     self._local_action = local_action
     ActionBase.__init__(self)
예제 #9
0
 def __init__(self, proxy_action, local_action):
     '''proxy_action and remote_action may be dragonfly.ActionBase
         subclasses or callables.'''
     assert(hasattr(proxy_action, 'execute') or
            hasattr(proxy_action, '__call__'))
     assert(hasattr(local_action, 'execute') or
            hasattr(local_action, '__call__'))
     self._proxy_action = proxy_action
     self._local_action = local_action
     ActionBase.__init__(self)
예제 #10
0
 def __init__(self,
              base,
              rspec="default",
              rdescript=None,
              rundo=None,
              show=True):
     ActionBase.__init__(self)
     self._nexus = None
     self.base = base
     self.rspec = rspec
     self.rdescript = rdescript
     self.rundo = rundo
     self.show = show
예제 #11
0
    def test_list_grammars(self):
        """ Verify that the 'list_grammars' RPC method works correctly. """
        # Load a Grammar with three rules and check that the RPC returns the
        # correct data for them.
        g = Grammar("list_grammars_test")
        g.add_rule(CompoundRule(name="compound", spec="testing",
                                exported=True))
        g.add_rule(
            MappingRule(name="mapping",
                        mapping={
                            "command a": ActionBase(),
                            "command b": ActionBase()
                        }))
        g.add_rule(
            Rule(name="base", element=Literal("hello world"), exported=False))
        g.load()

        response = self.send_request("list_grammars", [])
        expected_grammar_data = {
            "name":
            g.name,
            "enabled":
            True,
            "active":
            True,
            "rules": [{
                "name": "compound",
                "specs": ["testing"],
                "exported": True,
                "active": True
            }, {
                "name": "mapping",
                "specs": ["command a", "command b"],
                "exported": True,
                "active": True
            }, {
                "name": "base",
                "specs": ["hello world"],
                "exported": False,
                "active": True
            }]
        }
        # Check that the loaded grammar appears in the result. It might not
        # be the only grammar and that is acceptable because dragonfly's
        # tests can be run while user grammars are loaded.
        try:
            self.assertIn("result", response)
            self.assertIn(expected_grammar_data, response["result"])
        finally:
            g.unload()
예제 #12
0
파일: css.py 프로젝트: gitter-badger/caster
def getCSSNode():
    H = hintnode.HintNode
    css_sections = []
    css_sections.append(_get_background())
    css_sections.append(_get_border())
    css_sections.append(_get_box())
    css_sections.append(_get_font())
    css_sections.append(_get_box_model())
    css_sections.append(_get_text())
    css_sections.append(_get_column())
    css_sections.append(_get_speech())
    css_sections += _get_miscellaneous()

    return H("css", ActionBase(), css_sections)
예제 #13
0
 def __init__(self, action):
     self.action = action
     ActionBase.__init__(self)
예제 #14
0
파일: hintnode.py 프로젝트: carver7/caster
 def __init__(self, node_rule, node):
     ActionBase.__init__(self)
     self.node_rule = node_rule
     self.node = node
예제 #15
0
 def __init__(self, name):
     self._name = name
     ActionBase.__init__(self)
예제 #16
0
 def __init__(self, action_id):
     ActionBase.__init__(self)
     self.action_id = action_id
예제 #17
0
파일: hintnode.py 프로젝트: tyoung87/caster
 def __init__(self, node_rule, node):
     ActionBase.__init__(self)
     self.node_rule = node_rule
     self.node = node
예제 #18
0
 def __init__(self, *actions):
     ActionBase.__init__(self)
     self._actions = list(actions)
     self._str = ", ".join(str(a) for a in actions)
예제 #19
0
 def __init__(self, space=" ", remove_cr=False, same_is_okay=True):
     ActionBase.__init__(self)
     self.space = space
     self.remove_cr = remove_cr
     self.same_is_okay = same_is_okay
예제 #20
0
 def __init__(self, default=None, actions=[]):
     self.actions = actions
     self.default = default
     ActionBase.__init__(self)
예제 #21
0
 def __init__(self, title, timeout = 5.0):
     ActionBase.__init__(self)
     self.winname = title
     self.timeout = timeout
예제 #22
0
 def __init__(self, execname):
     ActionBase.__init__(self)
     self.execname = execname
예제 #23
0
 def __init__(self, *args, **kwargs):
     ActionBase.__init__(self)
     self.args = args
     self.kwargs = kwargs
예제 #24
0
 def __init__(self, grammarString, dclient, ruleHash):
     self.dclient = dclient
     self.grammarString = grammarString
     self.ruleHash = ruleHash
     ActionBase.__init__(self)
예제 #25
0
 def __init__(self, grammarString, dclient, ruleHash):
     self.dclient = dclient
     self.grammarString = grammarString
     self.ruleHash = ruleHash
     ActionBase.__init__(self)
예제 #26
0
 def __init__(self, name, action):
     ActionBase.__init__(self)
     self.name = name
     self.action = action
예제 #27
0
 def __init__(self, action_if_no_text="", action_if_text=""):
     ActionBase.__init__(self)
     self.action_if_no_text = action_if_no_text
     self.action_if_text = action_if_text
예제 #28
0
 def __init__(self, space=" ", remove_cr=False):
     ActionBase.__init__(self)
     self.space = space
     self.remove_cr = remove_cr
예제 #29
0
 def __init__(self, *actions):
     ActionBase.__init__(self)
     self._actions = list(actions)
     self._str = ", ".join(str(a) for a in actions)
예제 #30
0
 def __init__(self, default=None, actions=[]):
     self.actions = actions
     self.default = default
     ActionBase.__init__(self)
예제 #31
0
 def __init__(self, text):
     ActionBase.__init__(self)
     self.__text = text
예제 #32
0
 def __init__(self, title, executable, timeout=5.0):
     ActionBase.__init__(self)
     self.title = title
     self.executable = executable
     self.timeout = timeout
예제 #33
0
 def __init__(self, command=""):
     ActionBase.__init__(self)
     self.command = command