From 79afb1ceeda0fe4ecd1411181bf3fe53b042f1e2 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Sat, 13 Oct 2012 20:09:31 +0300 Subject: [PATCH] more timely update of receiver status when starting the app --- app/watcher.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/watcher.py b/app/watcher.py index 054f66dd..9653232f 100644 --- a/app/watcher.py +++ b/app/watcher.py @@ -89,7 +89,7 @@ class Watcher(Thread): self.no_receiver.clear() else: self._device_status_changed(self.rstatus, C.STATUS.UNAVAILABLE, _NO_RECEIVER) - time.sleep(5) + time.sleep(3) if self.listener: self.listener.stop() @@ -157,6 +157,11 @@ class Watcher(Thread): if status_code >= C.STATUS.CONNECTED and devstatus.type is None: # ghost device that became active + if devstatus.code != C.STATUS.CONNECTED: + # initial update, while we're getting the devinfo + devstatus.code = C.STATUS.CONNECTED + devstatus.text = C.STATUS_NAME[C.STATUS.CONNECTED] + self.status_changed.set() if self._new_device(devstatus.number) is None: _l.warn("could not materialize device from %s", devstatus) return False @@ -210,6 +215,7 @@ class Watcher(Thread): ghost = _DevStatus(handle=self.listener.receiver, number=event.devnumber, type=None, name=name, features=[]) self.devices[event.devnumber] = ghost self._device_status_changed(ghost, C.STATUS.UNAVAILABLE) + self._device_status_changed(self.rstatus, C.STATUS.CONNECTED, _OKAY) return if event.devnumber in self.devices: