diff frontends/src/jp/cmd_adhoc.py @ 1864:96ba685162f6

jp: all commands now use the new start method and set need_loop in __init__ when needed
author Goffi <goffi@goffi.org>
date Mon, 29 Feb 2016 16:52:51 +0100
parents d17772b0fe22
children 16e65f15f31f
line wrap: on
line diff
--- a/frontends/src/jp/cmd_adhoc.py	Mon Feb 29 16:52:51 2016 +0100
+++ b/frontends/src/jp/cmd_adhoc.py	Mon Feb 29 16:52:51 2016 +0100
@@ -17,11 +17,7 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from logging import debug, info, error, warning
-
 import base
-import sys
-import os
 from sat.core.i18n import _
 
 __commands__ = ["AdHoc"]
@@ -31,7 +27,7 @@
 
 class Remote(base.CommandBase):
     def __init__(self, host):
-        super(Remote, self).__init__(host, 'remote', help=_('Remote control a software'))
+        super(Remote, self).__init__(host, 'remote', use_verbose=True, help=_('Remote control a software'))
 
     def add_parser_options(self):
         self.parser.add_argument("software", type=str, help=_("Software name"))
@@ -41,8 +37,7 @@
         self.parser.add_argument("--forbidden-jids", type=base.unicode_decoder, nargs='*', default=[], help=_("Jids that are *NOT* allowed to use the command"))
         self.parser.add_argument("-l", "--loop", action="store_true", help=_("Loop on the commands"))
 
-    def connected(self):
-        super(Remote, self).connected()
+    def start(self):
         name = self.args.software.lower()
         flags = []
         magics = {jid for jid in self.args.jids if jid.count('@')>1}
@@ -53,13 +48,13 @@
         bus_name, methods = self.host.bridge.adHocDBusAddAuto(name, jids, self.args.groups, magics,
                                                               self.args.forbidden_jids, self.args.forbidden_groups,
                                                               flags, self.profile)
-        debug(_("Bus name found: [%s]" % bus_name))
+        self.disp(_("Bus name found: [%s]" % bus_name), 1)
         for method in methods:
             path, iface, command = method
-            debug (_("Command found: (path:%(path)s, iface: %(iface)s) [%(command)s]" % {'path': path,
+            self.disp(_("Command found: (path:%(path)s, iface: %(iface)s) [%(command)s]" % {'path': path,
                                                                                          'iface': iface,
                                                                                          'command': command
-                                                                                         }))
+                                                                                         }),1)
 
 class AdHoc(base.CommandBase):
     subcommands = (Remote,)