temporary threading fix. ui short update

This commit is contained in:
ingvar1995 2016-03-21 15:04:53 +03:00
parent e920e8e021
commit 75225e5b34
2 changed files with 11 additions and 11 deletions

View file

@ -161,15 +161,11 @@ def tox_file_recv(window, tray):
def file_recv_chunk(tox, friend_number, file_number, position, chunk, length, user_data): def file_recv_chunk(tox, friend_number, file_number, position, chunk, length, user_data):
invoke_in_main_thread(Profile.get_instance().incoming_chunk, Profile.get_instance().incoming_chunk(friend_number, file_number, position, chunk[:length] if length else None)
friend_number,
file_number,
position,
chunk[:length] if length else None)
def file_chunk_request(tox, friend_number, file_number, position, size, user_data): def file_chunk_request(tox, friend_number, file_number, position, size, user_data):
invoke_in_main_thread(Profile.get_instance().outgoing_chunk, Profile.get_instance().outgoing_chunk(
friend_number, friend_number,
file_number, file_number,
position, position,

View file

@ -206,10 +206,14 @@ class FileTransferItem(QtGui.QListWidget):
font.setPointSize(12) font.setPointSize(12)
self.file_name.setFont(font) self.file_name.setFont(font)
self.file_name.setObjectName("time") self.file_name.setObjectName("time")
size /= 1024 file_size = size / 1024
if not size: if not file_size:
size = '<1' file_size = '<1KB'
self.file_name.setText(u'{}KB {}'.format(size, file_name)) elif file_size >= 1024:
file_size = '{}MB'.format(file_size / 1024)
else:
file_size = '{}KB'.format(file_size)
self.file_name.setText(u'{} {}'.format(file_size, file_name))
self.file_name.setStyleSheet('QLabel { color: black; }') self.file_name.setStyleSheet('QLabel { color: black; }')
self.saved_name = file_name self.saved_name = file_name
@ -240,4 +244,4 @@ class FileTransferItem(QtGui.QListWidget):
elif int(arr[0]) == TOX_FILE_TRANSFER_STATE['FINISHED']: elif int(arr[0]) == TOX_FILE_TRANSFER_STATE['FINISHED']:
self.pb.setVisible(False) self.pb.setVisible(False)
self.cancel.setVisible(False) self.cancel.setVisible(False)
print data