From 0ce60deb34a62112123aaa4fdf63791f06ce0893 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 11 Jul 2019 20:18:17 +1000 Subject: [PATCH] Don't start listening twice We get a notification for listening going to True after start_listening(), but we don't need to start it again in that case. --- tuhigui/drawingperspective.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tuhigui/drawingperspective.py b/tuhigui/drawingperspective.py index cf2085d..86fb42b 100644 --- a/tuhigui/drawingperspective.py +++ b/tuhigui/drawingperspective.py @@ -82,8 +82,12 @@ class DrawingPerspective(Gtk.Stack): return "drawing_perspective" def _on_connected(self, device, pspec): + # Turns out we don't really care about whether the device is + # connected or not, it has little effect on how we work here pass def _on_listening_stopped(self, device, pspec): - # We never want to stop listening - device.start_listening() + if not device.listening: + logger.debug(f'{device.name} - listening stopped, restarting') + # We never want to stop listening + device.start_listening()