diff --git a/tools/tuhi-kete.py b/tools/tuhi-kete.py index cbd5745..66b3331 100755 --- a/tools/tuhi-kete.py +++ b/tools/tuhi-kete.py @@ -231,6 +231,8 @@ class TuhiKeteManager(_DBusObject): __gsignals__ = { 'pairable-device': (GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)), + 'dbus-name-vanished': + (GObject.SIGNAL_RUN_FIRST, None, ()), } def __init__(self): @@ -320,8 +322,8 @@ class TuhiKeteManager(_DBusObject): def _on_name_vanished(self, connection, name): logger.error('Tuhi daemon went away') + self.emit('dbus-name-vanished') self.mainloop.quit() - # FIXME: need to bubble this up to the Worker def __getitem__(self, btaddr): return self._devices[btaddr] @@ -541,12 +543,16 @@ class TuhiKeteShell(cmd.Cmd): logger.addHandler(self._log_handler) # patching get_names to hide some functions we do not want in the help self.get_names = self._filtered_get_names + manager.connect('dbus-name-vanished', self._on_name_vanished) def _filtered_get_names(self): names = super(TuhiKeteShell, self).get_names() names.remove('do_EOF') return names + def _on_name_vanished(self, manager): + logger.debug('Tuhi daemon went away, I should stop the current workers') + def emptyline(self): # make sure we do not re-enter the last typed command pass