bug fix - repaint

This commit is contained in:
ingvar1995 2016-06-16 00:12:27 +03:00
parent 85061454a6
commit 5c4bfceee7
3 changed files with 14 additions and 2 deletions

View file

@ -151,7 +151,7 @@ def friend_read_receipt(tox, friend_number, message_id, user_data):
profile = Profile.get_instance()
profile.get_friend_by_number(friend_number).dec_receipt()
if friend_number == profile.get_active_number():
invoke_in_main_thread(profile.update) # TODO: improve
invoke_in_main_thread(profile.receipt)
# -----------------------------------------------------------------------------------------------------------------
# Callbacks - file transfers

View file

@ -123,6 +123,7 @@ class MessageItem(QtGui.QWidget):
movie = QtGui.QMovie(curr_directory() + '/images/spinner.gif')
self.time.setMovie(movie)
movie.start()
self.t = time
else:
self.time.setText(time)
@ -136,6 +137,12 @@ class MessageItem(QtGui.QWidget):
self.message.setAlignment(QtCore.Qt.AlignCenter)
self.time.setStyleSheet("QLabel { color: #5CB3FF; }")
def mark_as_sent(self):
if hasattr(self, 't'):
self.time.setText(self.t)
return True
return False
class ContactItem(QtGui.QWidget):
"""

View file

@ -306,6 +306,11 @@ class Profile(contact.Contact, Singleton):
# Private messages
# -----------------------------------------------------------------------------------------------------------------
def receipt(self):
i = 0
while i < self._messages.count() and not self._messages.itemWidget(self._messages.item(i)).mark_as_sent():
i += 1
def send_messages(self, friend_number):
"""
Send 'offline' messages to friend
@ -976,7 +981,7 @@ class Profile(contact.Contact, Singleton):
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'],
inline)
self.update()
self.update() # not load all messages?
else:
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
FILE_TRANSFER_MESSAGE_STATUS['FINISHED'])