------------------------------------------------------------ revno: 3720 committer: Anton Gladky <gladky.an...@gmail.com> timestamp: Fri 2015-08-28 21:31:57 +0200 message: Fix QThread issue. modified: cMake/FindQGLVIEWER.cmake core/main/main.py.in py/remote.py
-- lp:yade https://code.launchpad.net/~yade-pkg/yade/git-trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'cMake/FindQGLVIEWER.cmake' --- cMake/FindQGLVIEWER.cmake 2015-08-28 19:31:57 +0000 +++ cMake/FindQGLVIEWER.cmake 2015-08-28 19:31:57 +0000 @@ -11,7 +11,7 @@ ) find_library(QGLVIEWER_LIBRARIES - NAMES QGLViewer + NAMES QGLViewer QGLViewer-qt4 ) IF(QGLVIEWER_INCLUDE_DIR AND QGLVIEWER_LIBRARIES) === modified file 'core/main/main.py.in' --- core/main/main.py.in 2015-08-27 09:47:31 +0000 +++ core/main/main.py.in 2015-08-28 19:31:57 +0000 @@ -265,7 +265,9 @@ # run remote access things, before actually starting the user session (not while imported by other python application) if __name__ == "__main__": from yade import remote - yade.remote.useQThread=(gui=='qt4') + if (gui=='qt4' or gui=='qt5'): + yade.remote.useQThread=True + yade.remote.gui=gui yade.remote.runServers() if gui==None: === modified file 'py/remote.py' --- py/remote.py 2015-08-28 19:31:57 +0000 +++ py/remote.py 2015-08-28 19:31:57 +0000 @@ -13,6 +13,7 @@ import yade.runtime useQThread=False +gui='' "Set before using any of our classes to use QThread for background execution instead of the standard thread module. Mixing the two (in case the qt4 UI is running, for instance) does not work well." plotImgFormat,plotImgMimetype='png','image/png' @@ -117,6 +118,11 @@ def _runInBackground(func): if useQThread: + if (gui=='qt4'): + from PyQt4.QtCore import QThread + elif (gui=='qt5'): + from PyQt5.QtCore import QThread + class WorkerThread(QThread): def __init__(self,func_): QThread.__init__(self); self.func=func_ def run(self): self.func() @@ -167,20 +173,20 @@ yade.runtime.cookie=srv.server.cookie #info=GenericTCPServer(handler=yade.remote.InfoSocketProvider,title='TCP info provider',cookie=False,minPort=21000) ## XMPRPC server for general information: - if 1: - from SimpleXMLRPCServer import SimpleXMLRPCServer - port,maxPort=21000,65535 # minimum port number - while port<maxPort: - try: - info=SimpleXMLRPCServer(('',port),logRequests=False,allow_none=True); break - except socket.error: port+=1 - if port==maxPort: raise RuntimeError("No free port to listen on in range 21000-%d"%maxPort) - # register methods, as per http://docs.python.org/library/simplexmlrpcserver.html#simplexmlrpcserver-example - info.register_instance(InfoProvider()) # gets all defined methods by introspection - #prov=InfoProvider() - #for m in prov.exposedMethods(): info.register_function(m) - _runInBackground(info.serve_forever) - print 'XMLRPC info provider on http://localhost:%d'%port + + from SimpleXMLRPCServer import SimpleXMLRPCServer + port,maxPort=21000,65535 # minimum port number + while port<maxPort: + try: + info=SimpleXMLRPCServer(('',port),logRequests=False,allow_none=True); break + except socket.error: port+=1 + if port==maxPort: raise RuntimeError("No free port to listen on in range 21000-%d"%maxPort) + # register methods, as per http://docs.python.org/library/simplexmlrpcserver.html#simplexmlrpcserver-example + info.register_instance(InfoProvider()) # gets all defined methods by introspection + #prov=InfoProvider() + #for m in prov.exposedMethods(): info.register_function(m) + _runInBackground(info.serve_forever) + print 'XMLRPC info provider on http://localhost:%d'%port sys.stdout.flush()
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp