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()
if file_type == TOX_FILE_KIND['DATA']:
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,
friend_number,
file_number,

View file

@ -1,7 +1,7 @@
from toxcore_enums_and_consts import TOX_FILE_KIND, TOX_FILE_CONTROL
from os.path import basename, getsize, exists
from os import remove
from time import time
from time import time, sleep
from tox import Tox
import settings
from PySide import QtCore
@ -56,6 +56,7 @@ class FileTransfer(QtCore.QObject):
def cancelled(self):
if hasattr(self, '_file'):
sleep(0.1)
self._file.close()
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.setGeometry(0, 0, 620, 250)
self.messages.setObjectName("messages")
self.messages.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
self.messages.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
def load(pos):
if not pos:

View file

@ -759,7 +759,6 @@ class Profile(Contact, Singleton):
"""
settings = Settings.get_instance()
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']
inline = (file_name == 'toxygen_inline.png' or file_name == 'utox-inline.png') and settings['allow_inline']
if inline and size < 1024 * 1024:

View file

@ -573,7 +573,7 @@ class Tox(object):
:return: friend number
"""
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))
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']: