bug fixes

This commit is contained in:
ingvar1995 2016-08-28 15:32:02 +03:00
parent 1caf7cd63c
commit 43d9a41dae
2 changed files with 7 additions and 3 deletions

View File

@ -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)

View File

@ -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'])