From e920e8e021c774bb864b4e030fc1fdc5654b7f58 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Mon, 21 Mar 2016 12:12:49 +0300 Subject: [PATCH] bug fixes --- src/file_transfers.py | 3 +++ src/list_items.py | 2 +- src/profile.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/file_transfers.py b/src/file_transfers.py index 7389722..d2a554f 100644 --- a/src/file_transfers.py +++ b/src/file_transfers.py @@ -46,6 +46,7 @@ class FileTransfer(QtCore.QObject): def cancel(self): self.send_control(TOX_FILE_CONTROL['CANCEL']) self._file.close() + print id(self._signal) self._signal.signal.emit('{} {}'.format(self.state, 0)) def send_control(self, control): @@ -76,8 +77,10 @@ class SendTransfer(FileTransfer): if size: self._file.seek(position) data = self._file.read(size) + # TODO: fix bug with wrong data for file_send_chunk self._tox.file_send_chunk(self._friend_number, self._file_number, position, data) self._signal.signal.emit('{} {}'.format(self.state, 0)) + #print self._friend_number, self._file_number, position, data else: self._file.close() self.state = TOX_FILE_TRANSFER_STATE['FINISHED'] diff --git a/src/list_items.py b/src/list_items.py index ae5724e..7f18af1 100644 --- a/src/list_items.py +++ b/src/list_items.py @@ -209,7 +209,7 @@ class FileTransferItem(QtGui.QListWidget): size /= 1024 if not size: size = '<1' - self.file_name.setText('{}KB {}'.format(size, file_name)) + self.file_name.setText(u'{}KB {}'.format(size, file_name)) self.file_name.setStyleSheet('QLabel { color: black; }') self.saved_name = file_name diff --git a/src/profile.py b/src/profile.py index 72a1511..68b55fe 100644 --- a/src/profile.py +++ b/src/profile.py @@ -719,9 +719,9 @@ class Profile(Contact, Singleton): friend = self.get_friend_by_number(friend_number) if settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends']: path = settings['auto_accept_path'] or curr_directory() - self.accept_transfer(path + '/' + file_name, friend_number, file_number) + self.accept_transfer(path + '/' + file_name.decode('utf-8'), friend_number, file_number) else: - self.create_file_transfer_item(file_name, size, friend_number, file_number, True) + self.create_file_transfer_item(file_name.decode('utf-8'), size, friend_number, file_number, True) def cancel_transfer(self, friend_number, file_number): if (friend_number, file_number) in self._file_transfers: