Mercurial > libervia-backend
changeset 1593:791c45ed8659
jp: added param/set command
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 14 Nov 2015 19:18:10 +0100 (2015-11-14) |
parents | d6d655238a93 |
children | 313f2bb7841b |
files | frontends/src/jp/cmd_param.py |
diffstat | 1 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/jp/cmd_param.py Sat Nov 14 19:18:10 2015 +0100 +++ b/frontends/src/jp/cmd_param.py Sat Nov 14 19:18:10 2015 +0100 @@ -57,7 +57,22 @@ print value +class Set(base.CommandBase): + def __init__(self, host): + super(Set, self).__init__(host, 'set', help=_('Set a parameter value')) + + def add_parser_options(self): + self.parser.add_argument("category", type=base.unicode_decoder, help=_(u"Category of the parameter")) + self.parser.add_argument("name", type=base.unicode_decoder, help=_(u"Name of the parameter")) + self.parser.add_argument("value", type=base.unicode_decoder, help=_(u"Name of the parameter")) + self.parser.add_argument("--security-limit", type=int, default=-1, help=_(u"Security limit")) + + def connected(self): + super(Set, self).connected() try: + self.host.bridge.setParam(self.args.name, self.args.value, self.args.category, self.args.security_limit, self.profile) + except Exception as e: + print u"Can set requested parameter: {}".format(e) class SaveTemplate(base.CommandBase): @@ -92,7 +107,7 @@ class Param(base.CommandBase): - subcommands = (Get, SaveTemplate, LoadTemplate) + subcommands = (Get, Set, SaveTemplate, LoadTemplate) def __init__(self, host): super(Param, self).__init__(host, 'param', use_profile=False, help=_('Save/load parameters template'))