callbacks.py created
This commit is contained in:
parent
8dae4fcad9
commit
01510f67e8
2 changed files with 16 additions and 14 deletions
14
src/callbacks.py
Normal file
14
src/callbacks.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# TODO: add all callbacks (use wrappers)
|
||||||
|
|
||||||
|
|
||||||
|
def status(a, b, c):
|
||||||
|
print 'WOW, it works!'
|
||||||
|
print str(b)
|
||||||
|
|
||||||
|
|
||||||
|
def friend_status(a, b, c, d, e):
|
||||||
|
print 'Friend connected! Friend number: ' + str(c)
|
||||||
|
|
||||||
|
|
||||||
|
def message(a, b, c, d, e, f):
|
||||||
|
print 'Message: ', str(d)
|
16
src/main.py
16
src/main.py
|
@ -4,6 +4,7 @@ from mainscreen import MainWindow
|
||||||
from profile import Profile, tox_factory
|
from profile import Profile, tox_factory
|
||||||
import sys
|
import sys
|
||||||
from PySide import QtCore, QtGui
|
from PySide import QtCore, QtGui
|
||||||
|
from callbacks import *
|
||||||
from tox import Tox
|
from tox import Tox
|
||||||
from bootstrap import node_generator
|
from bootstrap import node_generator
|
||||||
|
|
||||||
|
@ -30,19 +31,6 @@ class login(object):
|
||||||
return self.arr[self.num]
|
return self.arr[self.num]
|
||||||
|
|
||||||
|
|
||||||
def status(a, b, c):
|
|
||||||
print 'WOW, it works!'
|
|
||||||
print str(b)
|
|
||||||
|
|
||||||
|
|
||||||
def friend_status(a, b, c, d, e):
|
|
||||||
print 'Friend connected! Friend number: ' + str(c)
|
|
||||||
|
|
||||||
|
|
||||||
def message(a, b, c, d, e, f):
|
|
||||||
print 'Message: ', str(d)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
main function of app. loads loginscreen if needed and starts mainscreen
|
main function of app. loads loginscreen if needed and starts mainscreen
|
||||||
|
@ -85,7 +73,7 @@ def main():
|
||||||
# bootstrap
|
# bootstrap
|
||||||
for data in node_generator():
|
for data in node_generator():
|
||||||
tox.bootstrap(*data)
|
tox.bootstrap(*data)
|
||||||
# TODO: set all callbacks (create callback.py) and init it with ms
|
# TODO: set all callbacks and init it with ms
|
||||||
tox.callback_friend_message(message, 0)
|
tox.callback_friend_message(message, 0)
|
||||||
tox.callback_self_connection_status(status, 0)
|
tox.callback_self_connection_status(status, 0)
|
||||||
# starting thread for tox iterate
|
# starting thread for tox iterate
|
||||||
|
|
Loading…
Reference in a new issue