kete: make Searcher and Listener symmetrical regarding logs

The 'searching' notification was only emitted when it goes to stop, which
means we do not get notifications when it starts.
This makes SearchStopped signal redundant for the generic case, but allows
to get notifications if the search failed to start.

Rest is just making sure we have the same handling of events in Listener
and Searcher.
This commit is contained in:
Benjamin Tissoires 2018-02-13 14:01:49 +01:00
parent d8808e144f
commit 590de68269
1 changed files with 8 additions and 3 deletions

View File

@ -346,6 +346,8 @@ class TuhiKeteManager(_DBusObject):
# in unregistered devices
pass
self.notify('devices')
if 'Searching' in changed_props:
self.notify('searching')
def _handle_unregistered_device(self, objpath):
for addr, dev in self._devices.items():
@ -418,8 +420,8 @@ class Searcher(Worker):
logger.error('Another client is already searching')
return
logger.debug(f'Starting searching')
self.manager.start_search()
logger.debug('Started searching')
def stop(self):
if self.manager.searching:
@ -432,6 +434,8 @@ class Searcher(Worker):
if not manager.searching:
logger.info('Search cancelled')
self.stop()
else:
logger.info('Search started')
def _on_unregistered_device(self, manager, device):
logger.info(f'Unregistered device: {device}')
@ -471,6 +475,7 @@ class Listener(Worker):
self.device.start_listening()
def stop(self):
if self.device.listening:
logger.debug(f'{self.device}: stopping listening')
self.device.stop_listening()