bug fixes

This commit is contained in:
ingvar1995 2016-03-21 12:12:49 +03:00
parent 6a2bc1f650
commit e920e8e021
3 changed files with 6 additions and 3 deletions

View file

@ -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']

View file

@ -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

View file

@ -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: