From 75225e5b345df5b609830d300f589e2c6c45995b Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Mon, 21 Mar 2016 15:04:53 +0300 Subject: [PATCH] temporary threading fix. ui short update --- src/callbacks.py | 8 ++------ src/list_items.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/callbacks.py b/src/callbacks.py index d69e614..f97d664 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -161,15 +161,11 @@ def tox_file_recv(window, tray): def file_recv_chunk(tox, friend_number, file_number, position, chunk, length, user_data): - invoke_in_main_thread(Profile.get_instance().incoming_chunk, - friend_number, - file_number, - position, - chunk[:length] if length else None) + Profile.get_instance().incoming_chunk(friend_number, file_number, position, chunk[:length] if length else None) 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, file_number, position, diff --git a/src/list_items.py b/src/list_items.py index 7f18af1..446bb09 100644 --- a/src/list_items.py +++ b/src/list_items.py @@ -206,10 +206,14 @@ class FileTransferItem(QtGui.QListWidget): font.setPointSize(12) self.file_name.setFont(font) self.file_name.setObjectName("time") - size /= 1024 - if not size: - size = '<1' - self.file_name.setText(u'{}KB {}'.format(size, file_name)) + file_size = size / 1024 + if not file_size: + file_size = '<1KB' + 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.saved_name = file_name @@ -240,4 +244,4 @@ class FileTransferItem(QtGui.QListWidget): elif int(arr[0]) == TOX_FILE_TRANSFER_STATE['FINISHED']: self.pb.setVisible(False) self.cancel.setVisible(False) - print data +