ft fixes
This commit is contained in:
parent
6a7a38ef02
commit
23b045070a
@ -109,3 +109,31 @@ class IncomingCallWidget(widgets.CenteredWidget):
|
||||
|
||||
def set_pixmap(self, pixmap):
|
||||
self.avatar_label.setPixmap(pixmap)
|
||||
|
||||
|
||||
class AudioMessageRecorder(widgets.CenteredWidget):
|
||||
|
||||
def __init__(self, friend_number, name):
|
||||
super(AudioMessageRecorder, self).__init__()
|
||||
self.label = QtGui.QLabel(self)
|
||||
self.label.setGeometry(QtCore.QRect(10, 20, 250, 20))
|
||||
text = QtGui.QApplication.translate("MenuWindow", "Send audio message to friend {}", None, QtGui.QApplication.UnicodeUTF8)
|
||||
self.label.setText(text.format(name))
|
||||
self.record = QtGui.QPushButton(self)
|
||||
self.record.setGeometry(QtCore.QRect(20, 100, 150, 150))
|
||||
|
||||
self.record.setText(QtGui.QApplication.translate("MenuWindow", "Start recording", None,
|
||||
QtGui.QApplication.UnicodeUTF8))
|
||||
self.record.clicked.connect(self.start_or_stop_recording)
|
||||
self.recording = False
|
||||
self.friend_num = friend_number
|
||||
|
||||
def start_or_stop_recording(self):
|
||||
if not self.recording:
|
||||
self.recording = True
|
||||
self.record.setText(QtGui.QApplication.translate("MenuWindow", "Stop recording", None,
|
||||
QtGui.QApplication.UnicodeUTF8))
|
||||
else:
|
||||
self.close()
|
||||
|
||||
|
||||
|
@ -94,9 +94,8 @@ def friend_name(tox, friend_num, name, size, user_data):
|
||||
Friend changed his name
|
||||
"""
|
||||
profile = Profile.get_instance()
|
||||
print 'New name: ', str(friend_num), str(name)
|
||||
if profile.get_active_number() == friend_num:
|
||||
invoke_in_main_thread(profile.new_name, friend_num, name)
|
||||
print 'New name: ', friend_num, name
|
||||
invoke_in_main_thread(profile.new_name, friend_num, name)
|
||||
|
||||
|
||||
def friend_status_message(tox, friend_num, status_message, size, user_data):
|
||||
|
@ -224,15 +224,14 @@ class ReceiveTransfer(FileTransfer):
|
||||
if data is None:
|
||||
self._file.close()
|
||||
self.state = TOX_FILE_TRANSFER_STATE['FINISHED']
|
||||
self._state_changed.signal.emit(self.state, 1)
|
||||
else: # TODO: improve
|
||||
data = ''.join(chr(x) for x in data)
|
||||
self.signal()
|
||||
else:
|
||||
data = bytearray(data)
|
||||
if self._file_size < position:
|
||||
self._file.seek(0, 2)
|
||||
self._file.write('\0' * (position - self._file_size))
|
||||
self._file.seek(position)
|
||||
self._file.write(data)
|
||||
self._file.flush()
|
||||
l = len(data)
|
||||
if position + l > self._file_size:
|
||||
self._file_size = position + l
|
||||
@ -258,9 +257,9 @@ class ReceiveToBuffer(FileTransfer):
|
||||
self._creation_time = time()
|
||||
if data is None:
|
||||
self.state = TOX_FILE_TRANSFER_STATE['FINISHED']
|
||||
self._state_changed.signal.emit(self.state, 1)
|
||||
self.signal()
|
||||
else:
|
||||
data = ''.join(chr(x) for x in data)
|
||||
data = bytearray(data)
|
||||
l = len(data)
|
||||
if self._data_size < position:
|
||||
self._data += ('\0' * (position - self._data_size))
|
||||
|
@ -291,7 +291,7 @@ class FileTransferItem(QtGui.QListWidget):
|
||||
self.pb.setVisible(state in SHOW_PROGRESS_BAR)
|
||||
|
||||
self.file_name = DataLabel(self)
|
||||
self.file_name.setGeometry(QtCore.QRect(210, 7, width - 440, 20))
|
||||
self.file_name.setGeometry(QtCore.QRect(210, 7, width - 420, 20))
|
||||
font.setPointSize(12)
|
||||
self.file_name.setFont(font)
|
||||
file_size = size / 1024
|
||||
@ -306,7 +306,7 @@ class FileTransferItem(QtGui.QListWidget):
|
||||
self.file_name.setToolTip(file_name)
|
||||
self.saved_name = file_name
|
||||
self.time_left = QtGui.QLabel(self)
|
||||
self.time_left.setGeometry(QtCore.QRect(width - 83, 7, 30, 20))
|
||||
self.time_left.setGeometry(QtCore.QRect(width - 87, 7, 30, 20))
|
||||
font.setPointSize(10)
|
||||
self.time_left.setFont(font)
|
||||
self.time_left.setVisible(state == TOX_FILE_TRANSFER_STATE['RUNNING'])
|
||||
|
@ -77,8 +77,18 @@ class Profile(contact.Contact, Singleton):
|
||||
self._tox.self_set_status(status)
|
||||
|
||||
def set_name(self, value):
|
||||
tmp = self.name
|
||||
super(Profile, self).set_name(value)
|
||||
self._tox.self_set_name(self._name.encode('utf-8'))
|
||||
if tmp != value:
|
||||
message = QtGui.QApplication.translate("MainWindow", 'User {} is now known as {}', None,
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
message = message.format(tmp, value)
|
||||
for friend in self._friends:
|
||||
friend.append_message(InfoMessage(message, time.time()))
|
||||
if self._active_friend + 1:
|
||||
self.create_message_item(message, curr_time(), '', MESSAGE_TYPE['INFO_MESSAGE'])
|
||||
self._messages.scrollToBottom()
|
||||
|
||||
def set_status_message(self, value):
|
||||
super(Profile, self).set_status_message(value)
|
||||
@ -104,7 +114,7 @@ class Profile(contact.Contact, Singleton):
|
||||
filter_str = filter_str.lower()
|
||||
for index, friend in enumerate(self._friends):
|
||||
friend.visibility = (friend.status is not None or not show_online) and (filter_str in friend.name.lower())
|
||||
friend.visibility = friend.visibility or friend.messages
|
||||
friend.visibility = friend.visibility or friend.messages or friend.actions
|
||||
if friend.visibility:
|
||||
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, 70))
|
||||
else:
|
||||
@ -237,7 +247,7 @@ class Profile(contact.Contact, Singleton):
|
||||
message = message.format(tmp, name)
|
||||
friend.append_message(InfoMessage(message, time.time()))
|
||||
friend.actions = True
|
||||
if friend.number == self.get_active_number():
|
||||
if number == self.get_active_number():
|
||||
self.create_message_item(message, curr_time(), '', MESSAGE_TYPE['INFO_MESSAGE'])
|
||||
self._messages.scrollToBottom()
|
||||
self.set_active(None)
|
||||
|
Loading…
Reference in New Issue
Block a user