autoreconnect and pyaudio fix
This commit is contained in:
parent
28cedae342
commit
e78ba3942b
@ -80,6 +80,8 @@ class Profile(contact.Contact, Singleton):
|
|||||||
super(Profile, self).set_status(status)
|
super(Profile, self).set_status(status)
|
||||||
if status is not None:
|
if status is not None:
|
||||||
self._tox.self_set_status(status)
|
self._tox.self_set_status(status)
|
||||||
|
else:
|
||||||
|
QtCore.QTimer.singleShot(30000, self.reconnect)
|
||||||
|
|
||||||
def set_name(self, value):
|
def set_name(self, value):
|
||||||
if self.name == value:
|
if self.name == value:
|
||||||
@ -787,8 +789,14 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self.status = None
|
self.status = None
|
||||||
for friend in self._friends:
|
for friend in self._friends:
|
||||||
friend.status = None
|
friend.status = None
|
||||||
|
friend.number = self._tox.friend_by_public_key(friend.tox_id)
|
||||||
self.update_filtration()
|
self.update_filtration()
|
||||||
|
|
||||||
|
def reconnect(self):
|
||||||
|
if self.status is None:
|
||||||
|
self.reset(self._screen.reset)
|
||||||
|
QtCore.QTimer.singleShot(30000, self.reconnect)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if hasattr(self, '_call'):
|
if hasattr(self, '_call'):
|
||||||
self._call.stop()
|
self._call.stop()
|
||||||
@ -1116,6 +1124,8 @@ class Profile(contact.Contact, Singleton):
|
|||||||
"""User clicked audio button in main window"""
|
"""User clicked audio button in main window"""
|
||||||
num = self.get_active_number()
|
num = self.get_active_number()
|
||||||
if num not in self._call and self.is_active_online(): # start call
|
if num not in self._call and self.is_active_online(): # start call
|
||||||
|
if not Settings.get_instance().audio['enabled']:
|
||||||
|
return
|
||||||
self._call(num, audio, video)
|
self._call(num, audio, video)
|
||||||
self._screen.active_call()
|
self._screen.active_call()
|
||||||
if video:
|
if video:
|
||||||
@ -1134,6 +1144,8 @@ class Profile(contact.Contact, Singleton):
|
|||||||
"""
|
"""
|
||||||
Incoming call from friend. Only audio is supported now
|
Incoming call from friend. Only audio is supported now
|
||||||
"""
|
"""
|
||||||
|
if not Settings.get_instance().audio['enabled']:
|
||||||
|
return
|
||||||
friend = self.get_friend_by_number(friend_number)
|
friend = self.get_friend_by_number(friend_number)
|
||||||
if video:
|
if video:
|
||||||
text = QtGui.QApplication.translate("incoming_call", "Incoming video call", None,
|
text = QtGui.QApplication.translate("incoming_call", "Incoming video call", None,
|
||||||
|
@ -34,10 +34,18 @@ class Settings(dict, Singleton):
|
|||||||
super(Settings, self).__init__(Settings.get_default_settings())
|
super(Settings, self).__init__(Settings.get_default_settings())
|
||||||
self.save()
|
self.save()
|
||||||
smileys.SmileyLoader(self)
|
smileys.SmileyLoader(self)
|
||||||
p = pyaudio.PyAudio()
|
|
||||||
self.locked = False
|
self.locked = False
|
||||||
self.audio = {'input': p.get_default_input_device_info()['index'],
|
p = pyaudio.PyAudio()
|
||||||
'output': p.get_default_output_device_info()['index']}
|
input_devices = output_devices = 0
|
||||||
|
for i in range(p.get_device_count()):
|
||||||
|
device = p.get_device_info_by_index(i)
|
||||||
|
if device["maxInputChannels"]:
|
||||||
|
input_devices += 1
|
||||||
|
if device["maxOutputChannels"]:
|
||||||
|
output_devices += 1
|
||||||
|
self.audio = {'input': p.get_default_input_device_info()['index'] if input_devices else -1,
|
||||||
|
'output': p.get_default_output_device_info()['index'] if output_devices else -1,
|
||||||
|
'enabled': input_devices and output_devices}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_auto_profile():
|
def get_auto_profile():
|
||||||
|
Loading…
Reference in New Issue
Block a user