jp: all commands now use the new start method and set need_loop in __init__ when needed

This commit is contained in:
Goffi 2016-02-29 16:52:51 +01:00
commit 169bc43793

View file

@ -34,8 +34,7 @@ class Get(base.CommandBase):
self.parser.add_argument("-a", "--attribute", type=str, default="value", help=_(u"Name of the attribute to get"))
self.parser.add_argument("--security-limit", type=int, default=-1, help=_(u"Security limit"))
def connected(self):
super(Get, self).connected()
def start(self):
if self.args.category is None:
categories = self.host.bridge.getParamsCategories()
print u"\n".join(categories)
@ -67,8 +66,7 @@ class Set(base.CommandBase):
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()
def start(self):
try:
self.host.bridge.setParam(self.args.name, self.args.value, self.args.category, self.args.security_limit, self.profile)
except Exception as e:
@ -82,7 +80,7 @@ class SaveTemplate(base.CommandBase):
def add_parser_options(self):
self.parser.add_argument("filename", type=str, help=_("Output file"))
def run(self):
def start(self):
"""Save parameters template to xml file"""
if self.host.bridge.saveParamsTemplate(self.args.filename):
print _("Parameters saved to file %s") % self.args.filename
@ -98,7 +96,7 @@ class LoadTemplate(base.CommandBase):
def add_parser_options(self):
self.parser.add_argument("filename", type=str, help=_("Input file"))
def run(self):
def start(self):
"""Load parameters template from xml file"""
if self.host.bridge.loadParamsTemplate(self.args.filename):
print _("Parameters loaded from file %s") % self.args.filename