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,7 +78,8 @@ class FileTransfer(QtCore.QObject):
t = ((time() - self._creation_time) / percentage) * (1 - percentage) t = ((time() - self._creation_time) / percentage) * (1 - percentage)
self._state_changed.signal.emit(self.state, percentage, int(t)) self._state_changed.signal.emit(self.state, percentage, int(t))
def finished(self): def finished(self, emit=False):
if type(self) is not ReceiveAvatar or emit:
self._finished.signal.emit(self._friend_number, self._file_number) self._finished.signal.emit(self._friend_number, self._file_number)
def get_file_number(self): def get_file_number(self):
@ -340,3 +341,4 @@ class ReceiveAvatar(ReceiveTransfer):
chdir(dirname(avatar_path)) chdir(dirname(avatar_path))
remove(avatar_path) remove(avatar_path)
rename(self._path, avatar_path) rename(self._path, avatar_path)
self.finished(True)

View file

@ -1100,6 +1100,7 @@ class Profile(contact.Contact, Singleton):
t = type(transfer) t = type(transfer)
if t is ReceiveAvatar: if t is ReceiveAvatar:
self.get_friend_by_number(friend_number).load_avatar() self.get_friend_by_number(friend_number).load_avatar()
if friend_number == self.get_active_number():
self.set_active(None) self.set_active(None)
elif t is ReceiveToBuffer or (t is SendFromBuffer and Settings.get_instance()['allow_inline']): # inline image elif t is ReceiveToBuffer or (t is SendFromBuffer and Settings.get_instance()['allow_inline']): # inline image
print('inline') print('inline')
@ -1115,6 +1116,7 @@ class Profile(contact.Contact, Singleton):
elem.setSizeHint(QtCore.QSize(self._messages.width(), item.height())) elem.setSizeHint(QtCore.QSize(self._messages.width(), item.height()))
self._messages.insertItem(count + i + 1, elem) self._messages.insertItem(count + i + 1, elem)
self._messages.setItemWidget(elem, item) self._messages.setItemWidget(elem, item)
self._messages.scrollToBottom()
elif t is not SendAvatar: elif t is not SendAvatar:
self.get_friend_by_number(friend_number).update_transfer_data(file_number, self.get_friend_by_number(friend_number).update_transfer_data(file_number,
TOX_FILE_TRANSFER_STATE['FINISHED']) TOX_FILE_TRANSFER_STATE['FINISHED'])