When attempting to provide a default value for a choice object in a mapping rule, The following error is observed on the remote machine running in the virtual box.
Backedtrace
Error loading _terminal from C:\NatLink\NatLink\MacroSystem\_terminal.py
Traceback (most recent call last):
File "C:\NatLink\NatLink\MacroSystem\core\natlinkmain.py", line 322, in loadFile
imp.load_module(modName,fndFile,fndName,fndDesc)
File "C:\NatLink\NatLink\MacroSystem\_terminal.py", line 15, in <module>
import cli_typescript
File "C:\NatLink\NatLink\MacroSystem\cli_typescript.py", line 17, in <module>
class TypescriptRule(MappingRule):
File "C:\NatLink\NatLink\MacroSystem\cli_typescript.py", line 25, in TypescriptRule
Choice('modifiercommand', modifiercommand, None, None)
TypeError: __init__() takes at most 4 arguments (5 given)
Inclusion
_terminal.py
# Dragonfly module for controlling the Linux terminal
# The context of this file will be strictly for terminal use
from aenea import *
import cli_typescript
terminal_context = aenea.wrappers.AeneaContext(
ProxyAppContext(match='regex', title='(?i).*simon@simon.*'), # app_id='Terminal'
AppContext(executable='Terminal')
)
grammar = Grammar("terminal", context=terminal_context)
....
grammar.add_rule(cli_typescript.TypescriptRule())
Grammar
cli_typescript.py
# The rules for the typescript command line
from aenea import *
tsccommand = {
"version": "-v ",
"watch": "-w ",
}
modifiercommand = {
"default": " ",
"all": "*.ts",
}
class TypescriptRule(MappingRule):
mapping = {
'typescript <tsccommand> <modifiercommand>': Text('tsc %(tsccommand)s'),
}
extras = [
Dictation("text"),
IntegerRef("n", 1, 100),
Choice('tsccommand', tsccommand),
Choice('modifiercommand', modifiercommand, None, "default")
]
defaults = {
"n": 1,
}
When attempting to provide a default value for a choice object in a mapping rule, The following error is observed on the remote machine running in the virtual box.
Backedtrace
Inclusion
_terminal.pyGrammar
cli_typescript.py