From 43d9a41dae949dd65883708edfd35aa571032c28 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 28 Aug 2016 15:32:02 +0300 Subject: [PATCH] bug fixes --- toxygen/file_transfers.py | 6 ++++-- toxygen/profile.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toxygen/file_transfers.py b/toxygen/file_transfers.py index 7b23ffc..70501b8 100644 --- a/toxygen/file_transfers.py +++ b/toxygen/file_transfers.py @@ -78,8 +78,9 @@ class FileTransfer(QtCore.QObject): t = ((time() - self._creation_time) / percentage) * (1 - percentage) self._state_changed.signal.emit(self.state, percentage, int(t)) - def finished(self): - self._finished.signal.emit(self._friend_number, self._file_number) + def finished(self, emit=False): + if type(self) is not ReceiveAvatar or emit: + self._finished.signal.emit(self._friend_number, self._file_number) def get_file_number(self): return self._file_number @@ -340,3 +341,4 @@ class ReceiveAvatar(ReceiveTransfer): chdir(dirname(avatar_path)) remove(avatar_path) rename(self._path, avatar_path) + self.finished(True) diff --git a/toxygen/profile.py b/toxygen/profile.py index 0356d88..3e4fbed 100644 --- a/toxygen/profile.py +++ b/toxygen/profile.py @@ -1100,7 +1100,8 @@ class Profile(contact.Contact, Singleton): t = type(transfer) if t is ReceiveAvatar: self.get_friend_by_number(friend_number).load_avatar() - self.set_active(None) + if friend_number == self.get_active_number(): + self.set_active(None) elif t is ReceiveToBuffer or (t is SendFromBuffer and Settings.get_instance()['allow_inline']): # inline image print('inline') inline = InlineImage(transfer.get_data()) @@ -1115,6 +1116,7 @@ class Profile(contact.Contact, Singleton): elem.setSizeHint(QtCore.QSize(self._messages.width(), item.height())) self._messages.insertItem(count + i + 1, elem) self._messages.setItemWidget(elem, item) + self._messages.scrollToBottom() elif t is not SendAvatar: self.get_friend_by_number(friend_number).update_transfer_data(file_number, TOX_FILE_TRANSFER_STATE['FINISHED'])