main.py update
This commit is contained in:
		
							parent
							
								
									296957ed5e
								
							
						
					
					
						commit
						565d800a6e
					
				
					 4 changed files with 30 additions and 5 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -11,3 +11,4 @@ src/libs
 | 
			
		|||
*~
 | 
			
		||||
*.iml
 | 
			
		||||
*.so
 | 
			
		||||
*.log
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										25
									
								
								src/main.py
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								src/main.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -29,6 +29,11 @@ class login(object):
 | 
			
		|||
        return self.arr[self.num]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def status(a, b, c):
 | 
			
		||||
    print 'WOW, it works!'
 | 
			
		||||
    print str(b)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    """
 | 
			
		||||
    main function of app. loads loginscreen if needed and starts mainscreen
 | 
			
		||||
| 
						 | 
				
			
			@ -64,22 +69,34 @@ def main():
 | 
			
		|||
    # loading profile
 | 
			
		||||
    print str(path), str(name)
 | 
			
		||||
    data = Profile.open_profile(path, name)
 | 
			
		||||
    # TODO: start tox iterate and set callbacks
 | 
			
		||||
    tox = Tox(data, settings)
 | 
			
		||||
    ms = MainWindow()
 | 
			
		||||
    # creating tox instance
 | 
			
		||||
    tox = Tox(data, settings)
 | 
			
		||||
    # TODO: set callbacks
 | 
			
		||||
    #tox.callback_self_connection_status(status, 0)
 | 
			
		||||
    # starting thread for tox iterate
 | 
			
		||||
    mainloop = ToxIterateThread(tox)
 | 
			
		||||
    mainloop.start()
 | 
			
		||||
 | 
			
		||||
    ms.show()
 | 
			
		||||
    app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()"))
 | 
			
		||||
    app.exec_()
 | 
			
		||||
    mainloop.stop = True
 | 
			
		||||
    mainloop.wait()
 | 
			
		||||
    del tox
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ToxIterateThread(QtCore.QThread):
 | 
			
		||||
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
    def __init__(self, tox):
 | 
			
		||||
        QtCore.QThread.__init__(self)
 | 
			
		||||
        self.tox = tox
 | 
			
		||||
        self.stop = False
 | 
			
		||||
 | 
			
		||||
    def run(self):
 | 
			
		||||
        pass
 | 
			
		||||
        while not self.stop:
 | 
			
		||||
            self.tox.iterate()
 | 
			
		||||
            self.msleep(self.tox.iteration_interval())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -202,7 +202,7 @@ class Tox(object):
 | 
			
		|||
        Return the time in milliseconds before tox_iterate() should be called again for optimal performance.
 | 
			
		||||
        :return: time in milliseconds
 | 
			
		||||
        """
 | 
			
		||||
        return int(self.libtoxcore.tox_iteration_interval(self._tox_pointer).value)
 | 
			
		||||
        return int(self.libtoxcore.tox_iteration_interval(self._tox_pointer))
 | 
			
		||||
 | 
			
		||||
    def iterate(self):
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
# TODO: add string to bin and bin to string (TOX ID) (and DHT connection?)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def log(data):
 | 
			
		||||
    with open("logs.log", "a") as fl:
 | 
			
		||||
        fl.write(str(data))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue