wrapper fixes and file transfer fix (pause)
This commit is contained in:
parent
177e180e37
commit
6192688e0c
@ -239,7 +239,6 @@ class ReceiveAvatar(ReceiveTransfer):
|
||||
elif exists(path):
|
||||
if not size:
|
||||
self.send_control(TOX_FILE_CONTROL['CANCEL'])
|
||||
self.state = TOX_FILE_TRANSFER_STATE['CANCELED']
|
||||
self._file.close()
|
||||
remove(path)
|
||||
remove(path + '.tmp')
|
||||
@ -250,7 +249,6 @@ class ReceiveAvatar(ReceiveTransfer):
|
||||
existing_hash = Tox.hash(data)
|
||||
if hash == existing_hash:
|
||||
self.send_control(TOX_FILE_CONTROL['CANCEL'])
|
||||
self.state = TOX_FILE_TRANSFER_STATE['CANCELED']
|
||||
remove(path + '.tmp')
|
||||
else:
|
||||
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
||||
|
@ -956,12 +956,18 @@ class Profile(Contact, Singleton):
|
||||
self._tox.file_control(friend_number, file_number, TOX_FILE_CONTROL['CANCEL'])
|
||||
|
||||
def pause_transfer(self, friend_number, file_number, by_friend=False):
|
||||
"""
|
||||
Pause transfer with specified data
|
||||
"""
|
||||
tr = self._file_transfers[(friend_number, file_number)]
|
||||
tr.pause(by_friend)
|
||||
t = FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'] if by_friend else FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_USER']
|
||||
self.get_friend_by_number(friend_number).update_transfer_data(file_number, t)
|
||||
|
||||
def resume_transfer(self, friend_number, file_number, by_friend=False):
|
||||
"""
|
||||
Resume transfer with specified data
|
||||
"""
|
||||
self.get_friend_by_number(friend_number).update_transfer_data(file_number,
|
||||
FILE_TRANSFER_MESSAGE_STATUS['OUTGOING'])
|
||||
tr = self._file_transfers[(friend_number, file_number)]
|
||||
@ -1001,7 +1007,7 @@ class Profile(Contact, Singleton):
|
||||
self._file_transfers[(friend.number, st.get_file_number())] = st
|
||||
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
||||
time.time(),
|
||||
FILE_TRANSFER_MESSAGE_STATUS['OUTGOING'],
|
||||
FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'], # OUTGOING NOT STARTED
|
||||
len(data),
|
||||
'toxygen_inline.png',
|
||||
friend.number,
|
||||
@ -1021,7 +1027,7 @@ class Profile(Contact, Singleton):
|
||||
self._file_transfers[(friend_number, st.get_file_number())] = st
|
||||
tm = TransferMessage(MESSAGE_OWNER['ME'],
|
||||
time.time(),
|
||||
FILE_TRANSFER_MESSAGE_STATUS['OUTGOING'],
|
||||
FILE_TRANSFER_MESSAGE_STATUS['PAUSED_BY_FRIEND'], # OUTGOING NOT STARTED
|
||||
os.path.getsize(path),
|
||||
os.path.basename(path),
|
||||
friend_number,
|
||||
|
@ -221,7 +221,7 @@ class Tox(object):
|
||||
"""
|
||||
tox_err_bootstrap = c_int()
|
||||
result = Tox.libtoxcore.tox_add_tcp_relay(self._tox_pointer, c_char_p(address), c_uint16(port),
|
||||
c_char_p(public_key), byref(tox_err_bootstrap))
|
||||
string_to_bin(public_key), byref(tox_err_bootstrap))
|
||||
tox_err_bootstrap = tox_err_bootstrap.value
|
||||
if tox_err_bootstrap == TOX_ERR_BOOTSTRAP['OK']:
|
||||
return bool(result)
|
||||
|
@ -344,7 +344,7 @@ class ToxAV(object):
|
||||
height Height (c_uint16) of the frame in pixels.
|
||||
y
|
||||
u
|
||||
v Plane data (c_char_p).
|
||||
v Plane data (POINTER(c_uint8)).
|
||||
The size of plane data is derived from width and height where
|
||||
Y = MAX(width, abs(ystride)) * height,
|
||||
U = MAX(width/2, abs(ustride)) * (height/2) and
|
||||
@ -357,7 +357,7 @@ class ToxAV(object):
|
||||
user_data pointer (c_void_p) to user_data
|
||||
:param user_data: pointer (c_void_p) to user data
|
||||
"""
|
||||
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, c_uint16, c_uint16, c_char_p, c_char_p, c_char_p, c_int32,
|
||||
c_int32, c_int32, c_void_p)
|
||||
c_callback = CFUNCTYPE(None, c_void_p, c_uint32, c_uint16, c_uint16, POINTER(c_uint8), POINTER(c_uint8),
|
||||
POINTER(c_uint8), c_int32, c_int32, c_int32, c_void_p)
|
||||
self.video_receive_frame_cb = c_callback(callback)
|
||||
ToxAV.libtoxav.toxav_callback_video_receive_frame(self._toxav_pointer, self.video_receive_frame_cb, user_data)
|
||||
|
Loading…
Reference in New Issue
Block a user