bug fixes

This commit is contained in:
ingvar1995 2016-04-20 12:32:28 +03:00
parent e88090ff17
commit 7b9204a88b
5 changed files with 9 additions and 4 deletions

View File

@ -147,7 +147,10 @@ def tox_file_recv(window, tray):
settings = Settings.get_instance() settings = Settings.get_instance()
if file_type == TOX_FILE_KIND['DATA']: if file_type == TOX_FILE_KIND['DATA']:
print 'file' print 'file'
file_name = file_name[:file_name_size] try:
file_name = unicode(file_name[:file_name_size].decode('utf-8'))
except:
file_name = u'toxygen_file'
invoke_in_main_thread(profile.incoming_file_transfer, invoke_in_main_thread(profile.incoming_file_transfer,
friend_number, friend_number,
file_number, file_number,

View File

@ -1,7 +1,7 @@
from toxcore_enums_and_consts import TOX_FILE_KIND, TOX_FILE_CONTROL from toxcore_enums_and_consts import TOX_FILE_KIND, TOX_FILE_CONTROL
from os.path import basename, getsize, exists from os.path import basename, getsize, exists
from os import remove from os import remove
from time import time from time import time, sleep
from tox import Tox from tox import Tox
import settings import settings
from PySide import QtCore from PySide import QtCore
@ -56,6 +56,7 @@ class FileTransfer(QtCore.QObject):
def cancelled(self): def cancelled(self):
if hasattr(self, '_file'): if hasattr(self, '_file'):
sleep(0.1)
self._file.close() self._file.close()
self._state_changed.signal.emit(TOX_FILE_CONTROL['CANCEL'], 1) self._state_changed.signal.emit(TOX_FILE_CONTROL['CANCEL'], 1)

View File

@ -222,6 +222,8 @@ class MainWindow(QtGui.QMainWindow):
self.messages = QtGui.QListWidget(widget) self.messages = QtGui.QListWidget(widget)
self.messages.setGeometry(0, 0, 620, 250) self.messages.setGeometry(0, 0, 620, 250)
self.messages.setObjectName("messages") self.messages.setObjectName("messages")
self.messages.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.messages.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
def load(pos): def load(pos):
if not pos: if not pos:

View File

@ -759,7 +759,6 @@ class Profile(Contact, Singleton):
""" """
settings = Settings.get_instance() settings = Settings.get_instance()
friend = self.get_friend_by_number(friend_number) friend = self.get_friend_by_number(friend_number)
file_name = file_name.decode('utf-8')
auto = settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends'] auto = settings['allow_auto_accept'] and friend.tox_id in settings['auto_accept_from_friends']
inline = (file_name == 'toxygen_inline.png' or file_name == 'utox-inline.png') and settings['allow_inline'] inline = (file_name == 'toxygen_inline.png' or file_name == 'utox-inline.png') and settings['allow_inline']
if inline and size < 1024 * 1024: if inline and size < 1024 * 1024:

View File

@ -573,7 +573,7 @@ class Tox(object):
:return: friend number :return: friend number
""" """
tox_err_friend_by_public_key = c_int() tox_err_friend_by_public_key = c_int()
result = Tox.libtoxcore.tox_friend_by_public_key(self._tox_pointer, c_char_p(public_key), result = Tox.libtoxcore.tox_friend_by_public_key(self._tox_pointer, string_to_bin(public_key),
addressof(tox_err_friend_by_public_key)) addressof(tox_err_friend_by_public_key))
tox_err_friend_by_public_key = tox_err_friend_by_public_key.value tox_err_friend_by_public_key = tox_err_friend_by_public_key.value
if tox_err_friend_by_public_key == TOX_ERR_FRIEND_BY_PUBLIC_KEY['OK']: if tox_err_friend_by_public_key == TOX_ERR_FRIEND_BY_PUBLIC_KEY['OK']: