kete: bubble up the dbus vanished errors
Not much is done for now, but the shell is notified, which is a big step
This commit is contained in:
parent
9b18339890
commit
501c891a12
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue