only save the configuration once when Solaar ends
This commit is contained in:
parent
04ea8293a8
commit
a29609df21
|
@ -77,8 +77,6 @@ class ReceiverListener(_listener.EventsListener):
|
||||||
_log.exception("closing receiver %s" % r.path)
|
_log.exception("closing receiver %s" % r.path)
|
||||||
self.status_changed_callback(r) #, _status.ALERT.NOTIFICATION)
|
self.status_changed_callback(r) #, _status.ALERT.NOTIFICATION)
|
||||||
|
|
||||||
configuration.save()
|
|
||||||
|
|
||||||
def tick(self, timestamp):
|
def tick(self, timestamp):
|
||||||
if not self.tick_period:
|
if not self.tick_period:
|
||||||
raise Exception("tick() should not be called without a tick_period: %s", self)
|
raise Exception("tick() should not be called without a tick_period: %s", self)
|
||||||
|
@ -134,20 +132,11 @@ class ReceiverListener(_listener.EventsListener):
|
||||||
assert device.receiver == self.receiver
|
assert device.receiver == self.receiver
|
||||||
|
|
||||||
if device.status is None:
|
if device.status is None:
|
||||||
# device was just un-paired
|
|
||||||
# it may be paired later, possibly to another receiver?
|
|
||||||
# so maybe we shouldn't forget about it
|
|
||||||
# configuration.forget(device)
|
|
||||||
|
|
||||||
# device was unpaired, and since the object is weakref'ed
|
# device was unpaired, and since the object is weakref'ed
|
||||||
# it won't be valid for much longer
|
# it won't be valid for much longer
|
||||||
_log.info("device %s was unpaired, ghosting", device)
|
_log.info("device %s was unpaired, ghosting", device)
|
||||||
device = _ghost(device)
|
device = _ghost(device)
|
||||||
|
|
||||||
# elif device.status:
|
|
||||||
# configuration.apply_to(device)
|
|
||||||
# configuration.acquire_from(device)
|
|
||||||
|
|
||||||
self.status_changed_callback(device, alert, reason)
|
self.status_changed_callback(device, alert, reason)
|
||||||
|
|
||||||
if device.status is None:
|
if device.status is None:
|
||||||
|
@ -228,6 +217,8 @@ def stop_all():
|
||||||
for l in listeners:
|
for l in listeners:
|
||||||
l.join()
|
l.join()
|
||||||
|
|
||||||
|
configuration.save()
|
||||||
|
|
||||||
|
|
||||||
_status_callback = None
|
_status_callback = None
|
||||||
_error_callback = None
|
_error_callback = None
|
||||||
|
|
Loading…
Reference in New Issue