Commit 24dfd3a0 authored by Dan Pascu's avatar Dan Pascu

Simplified logic of resetting statuses with limited lifetimes

parent f988d6c9
...@@ -1804,8 +1804,8 @@ class AudioSessionItem(object): ...@@ -1804,8 +1804,8 @@ class AudioSessionItem(object):
self.widget.record_button.setEnabled(False) self.widget.record_button.setEnabled(False)
self.widget.hangup_button.setEnabled(False) self.widget.hangup_button.setEnabled(False)
def _reset_status(self): def _reset_status(self, expected_status):
if not self.__deleted__ and not self.blink_session.on_hold: if self.status == expected_status:
self.status = None self.status = None
def _SH_HangupButtonClicked(self): def _SH_HangupButtonClicked(self):
...@@ -1891,7 +1891,7 @@ class AudioSessionItem(object): ...@@ -1891,7 +1891,7 @@ class AudioSessionItem(object):
self.widget.record_button.setEnabled(True) self.widget.record_button.setEnabled(True)
self.widget.hangup_button.setEnabled(True) self.widget.hangup_button.setEnabled(True)
self.status = Status('Connected') self.status = Status('Connected')
call_later(3, self._reset_status) call_later(3, self._reset_status, self.status) # reset status 3 seconds later if it hasn't changed until then
else: else:
self.status = Status('Audio refused', color='#900000') self.status = Status('Audio refused', color='#900000')
self._cleanup() self._cleanup()
...@@ -1903,7 +1903,7 @@ class AudioSessionItem(object): ...@@ -1903,7 +1903,7 @@ class AudioSessionItem(object):
self.widget.record_button.setEnabled(True) self.widget.record_button.setEnabled(True)
self.widget.hangup_button.setEnabled(True) self.widget.hangup_button.setEnabled(True)
self.status = Status('Connected') self.status = Status('Connected')
call_later(3, self._reset_status) call_later(3, self._reset_status, self.status) # reset status 3 seconds later if it hasn't changed until then
def _NH_BlinkSessionDidNotAddStream(self, notification): def _NH_BlinkSessionDidNotAddStream(self, notification):
if notification.data.stream.type == 'audio': if notification.data.stream.type == 'audio':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment