audio, smileys fixes
This commit is contained in:
parent
b9cbf809b5
commit
55f13cbfd1
@ -280,9 +280,9 @@ def callback_audio(toxav, friend_number, samples, audio_samples_per_channel, aud
|
|||||||
"""
|
"""
|
||||||
New audio chunk
|
New audio chunk
|
||||||
"""
|
"""
|
||||||
# print audio_samples_per_channel, audio_channels_count, rate
|
# print(audio_samples_per_channel, audio_channels_count, rate)
|
||||||
Profile.get_instance().call.chunk(
|
Profile.get_instance().call.chunk(
|
||||||
''.join(chr(x) for x in samples[:audio_samples_per_channel * 2 * audio_channels_count]),
|
bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]),
|
||||||
audio_channels_count,
|
audio_channels_count,
|
||||||
rate)
|
rate)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class AV:
|
|||||||
self._audio_rate = 8000
|
self._audio_rate = 8000
|
||||||
self._audio_channels = 1
|
self._audio_channels = 1
|
||||||
self._audio_duration = 60
|
self._audio_duration = 60
|
||||||
self._audio_sample_count = self._audio_rate * self._audio_channels * self._audio_duration / 1000
|
self._audio_sample_count = self._audio_rate * self._audio_channels * self._audio_duration // 1000
|
||||||
|
|
||||||
def __contains__(self, friend_number):
|
def __contains__(self, friend_number):
|
||||||
return friend_number in self._calls
|
return friend_number in self._calls
|
||||||
|
@ -423,7 +423,8 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
def send_smiley(self):
|
def send_smiley(self):
|
||||||
self.menu.hide()
|
self.menu.hide()
|
||||||
if self.profile.active_friend + 1:
|
if self.profile.active_friend + 1:
|
||||||
self.smiley = SmileyWindow(self)
|
if not hasattr(self, 'smiley'):
|
||||||
|
self.smiley = SmileyWindow(self)
|
||||||
self.smiley.setGeometry(QtCore.QRect(self.x() if Settings.get_instance()['mirror_mode'] else 270 + self.x(),
|
self.smiley.setGeometry(QtCore.QRect(self.x() if Settings.get_instance()['mirror_mode'] else 270 + self.x(),
|
||||||
self.y() + self.height() - 200,
|
self.y() + self.height() - 200,
|
||||||
self.smiley.width(),
|
self.smiley.width(),
|
||||||
|
@ -133,10 +133,10 @@ class SmileyWindow(QtGui.QWidget):
|
|||||||
count = len(self.data)
|
count = len(self.data)
|
||||||
self.page_size = int(pow(count / 8, 0.5) + 1) * 8 # smileys per page
|
self.page_size = int(pow(count / 8, 0.5) + 1) * 8 # smileys per page
|
||||||
if count % self.page_size == 0:
|
if count % self.page_size == 0:
|
||||||
self.page_count = count / self.page_size
|
self.page_count = count // self.page_size
|
||||||
else:
|
else:
|
||||||
self.page_count = int(count / float(self.page_size) + 0.5)
|
self.page_count = int(count / float(self.page_size) + 0.5)
|
||||||
self.page = 0
|
self.page = -1
|
||||||
self.radio = []
|
self.radio = []
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
for i in range(self.page_count): # buttons with smileys
|
for i in range(self.page_count): # buttons with smileys
|
||||||
|
@ -913,7 +913,6 @@ class Profile(contact.Contact, Singleton):
|
|||||||
self.send_inline(data, 'sticker.png')
|
self.send_inline(data, 'sticker.png')
|
||||||
|
|
||||||
def send_inline(self, data, file_name, friend_number=None, is_resend=False):
|
def send_inline(self, data, file_name, friend_number=None, is_resend=False):
|
||||||
print('Send inline:' + str(type(data)))
|
|
||||||
friend_number = friend_number or self.get_active_number()
|
friend_number = friend_number or self.get_active_number()
|
||||||
friend = self.get_friend_by_number(friend_number)
|
friend = self.get_friend_by_number(friend_number)
|
||||||
if friend.status is None and not is_resend:
|
if friend.status is None and not is_resend:
|
||||||
|
@ -41,7 +41,7 @@ class SmileyLoader(util.Singleton):
|
|||||||
if value not in values:
|
if value not in values:
|
||||||
keys.append(key)
|
keys.append(key)
|
||||||
values.append(value)
|
values.append(value)
|
||||||
self._list = zip(keys, values)
|
self._list = list(zip(keys, values))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self._smileys = {}
|
self._smileys = {}
|
||||||
self._list = []
|
self._list = []
|
||||||
@ -55,7 +55,7 @@ class SmileyLoader(util.Singleton):
|
|||||||
return [x[1] for x in os.walk(d)][0]
|
return [x[1] for x in os.walk(d)][0]
|
||||||
|
|
||||||
def get_smileys(self):
|
def get_smileys(self):
|
||||||
return list(self._list)[:]
|
return list(self._list)
|
||||||
|
|
||||||
def add_smileys_to_text(self, text, edit):
|
def add_smileys_to_text(self, text, edit):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user