update of test, callbacks, linux load
This commit is contained in:
parent
18e027ffd9
commit
b9d102a15a
@ -11,10 +11,15 @@ def friend_status(a, b, c, d):
|
|||||||
|
|
||||||
|
|
||||||
def friend_message(a, b, c, d, e, f):
|
def friend_message(a, b, c, d, e, f):
|
||||||
print 'Message: ', unicode(d, "utf-8")
|
print 'Message: ', str(d)
|
||||||
|
|
||||||
|
|
||||||
def init_callbacks(tox):
|
def init_callbacks(tox, window):
|
||||||
|
"""
|
||||||
|
:param tox: tox instance
|
||||||
|
:param window: main window
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
tox.callback_friend_status(friend_status, 0)
|
tox.callback_friend_status(friend_status, 0)
|
||||||
tox.callback_friend_message(friend_message, 0)
|
tox.callback_friend_message(friend_message, 0)
|
||||||
tox.callback_self_connection_status(self_connection_status, 0)
|
tox.callback_self_connection_status(self_connection_status, 0)
|
||||||
|
@ -73,7 +73,7 @@ def main():
|
|||||||
# bootstrap
|
# bootstrap
|
||||||
for data in node_generator():
|
for data in node_generator():
|
||||||
tox.bootstrap(*data)
|
tox.bootstrap(*data)
|
||||||
init_callbacks(tox)
|
init_callbacks(tox, ms)
|
||||||
# starting thread for tox iterate
|
# starting thread for tox iterate
|
||||||
mainloop = ToxIterateThread(tox)
|
mainloop = ToxIterateThread(tox)
|
||||||
mainloop.start()
|
mainloop.start()
|
||||||
|
@ -24,9 +24,8 @@ class ToxOptions(Structure):
|
|||||||
class LibToxCore(object):
|
class LibToxCore(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if system() == 'Linux':
|
if system() == 'Linux':
|
||||||
temp = os.path.dirname(os.path.abspath(__file__)) + '/libs/'
|
# be sure that libtoxcore and libsodium are installed in your os
|
||||||
os.chdir(temp)
|
self._libtoxcore = CDLL('libtoxcore.so')
|
||||||
self._libtoxcore = CDLL(temp + 'libtoxcore.so')
|
|
||||||
elif system() == 'Windows':
|
elif system() == 'Windows':
|
||||||
self._libtoxcore = CDLL('libs/libtox.dll')
|
self._libtoxcore = CDLL('libs/libtox.dll')
|
||||||
else:
|
else:
|
||||||
|
@ -2,7 +2,7 @@ from src.settings import Settings
|
|||||||
from src.util import bin_to_string, string_to_bin
|
from src.util import bin_to_string, string_to_bin
|
||||||
import sys
|
import sys
|
||||||
from src.bootstrap import node_generator
|
from src.bootstrap import node_generator
|
||||||
from src.profile import Profile
|
from src.profile import Profile, tox_factory
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
@ -55,3 +55,14 @@ class TestNodeGen():
|
|||||||
def test_ports(self):
|
def test_ports(self):
|
||||||
for elem in node_generator():
|
for elem in node_generator():
|
||||||
assert elem[1] in [33445, 443, 5190, 2306, 1813]
|
assert elem[1] in [33445, 443, 5190, 2306, 1813]
|
||||||
|
|
||||||
|
|
||||||
|
class TestTox():
|
||||||
|
|
||||||
|
def test_creation(self):
|
||||||
|
data = Profile.open_profile(Settings.get_default_path(), 'tox_save')
|
||||||
|
settings = Settings.get_default_settings()
|
||||||
|
tox = tox_factory(data, settings)
|
||||||
|
for data in node_generator():
|
||||||
|
tox.bootstrap(*data)
|
||||||
|
del tox
|
||||||
|
Loading…
Reference in New Issue
Block a user