incoming call widget update
This commit is contained in:
parent
0a378c1682
commit
9031a4a3e3
6
setup.py
6
setup.py
@ -8,15 +8,15 @@ import sys
|
||||
|
||||
version = program_version + '.0'
|
||||
|
||||
MODULES = ['numpy']
|
||||
MODULES = ['numpy', 'PyQt5']
|
||||
|
||||
if system() in ('Windows', 'Darwin'):
|
||||
MODULES.extend(['PyAudio', 'PyQt5'])
|
||||
MODULES.append('PyAudio')
|
||||
else:
|
||||
try:
|
||||
import pyaudio
|
||||
except ImportError:
|
||||
MODULES.append('PyAudio') # TODO: ?
|
||||
MODULES.append('PyAudio')
|
||||
|
||||
DEP_LINKS = []
|
||||
|
||||
|
@ -7,8 +7,6 @@ import wave
|
||||
import settings
|
||||
from util import curr_directory
|
||||
|
||||
# TODO: improve IncomingCallWidget
|
||||
|
||||
|
||||
class IncomingCallWidget(widgets.CenteredWidget):
|
||||
|
||||
@ -21,6 +19,7 @@ class IncomingCallWidget(widgets.CenteredWidget):
|
||||
self.avatar_label.setScaledContents(False)
|
||||
self.name = widgets.DataLabel(self)
|
||||
self.name.setGeometry(QtCore.QRect(90, 20, 300, 25))
|
||||
self._friend_number = friend_number
|
||||
font = QtGui.QFont()
|
||||
font.setFamily(settings.Settings.get_instance()['font'])
|
||||
font.setPointSize(16)
|
||||
@ -53,10 +52,10 @@ class IncomingCallWidget(widgets.CenteredWidget):
|
||||
self.setWindowTitle(text)
|
||||
self.name.setText(name)
|
||||
self.call_type.setText(text)
|
||||
pr = profile.Profile.get_instance()
|
||||
self.accept_audio.clicked.connect(lambda: pr.accept_call(friend_number, True, False) or self.stop())
|
||||
self.accept_video.clicked.connect(lambda: pr.accept_call(friend_number, True, True) or self.stop())
|
||||
self.decline.clicked.connect(lambda: pr.stop_call(friend_number, False) or self.stop())
|
||||
self._processing = False
|
||||
self.accept_audio.clicked.connect(self.accept_call_with_audio)
|
||||
self.accept_video.clicked.connect(self.accept_call_with_video)
|
||||
self.decline.clicked.connect(self.decline_call)
|
||||
|
||||
class SoundPlay(QtCore.QThread):
|
||||
|
||||
@ -107,6 +106,30 @@ class IncomingCallWidget(widgets.CenteredWidget):
|
||||
self.thread.wait()
|
||||
self.close()
|
||||
|
||||
def accept_call_with_audio(self):
|
||||
if self._processing:
|
||||
return
|
||||
self._processing = True
|
||||
pr = profile.Profile.get_instance()
|
||||
pr.accept_call(self._friend_number, True, False)
|
||||
self.stop()
|
||||
|
||||
def accept_call_with_video(self):
|
||||
if self._processing:
|
||||
return
|
||||
self._processing = True
|
||||
pr = profile.Profile.get_instance()
|
||||
pr.accept_call(self._friend_number, True, True)
|
||||
self.stop()
|
||||
|
||||
def decline_call(self):
|
||||
if self._processing:
|
||||
return
|
||||
self._processing = True
|
||||
pr = profile.Profile.get_instance()
|
||||
pr.stop_call(self._friend_number, False)
|
||||
self.stop()
|
||||
|
||||
def set_pixmap(self, pixmap):
|
||||
self.avatar_label.setPixmap(pixmap)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user