At the risk of interleaving two questions, I'd like to share some progress and
ask for help for an issue that's a blocker.
In order to implement synchronization of views of two Coot 0.9.x windows, I
thought I could start a simple HTTP server on the primary and respond with the
current view matrix (either via view_matrix() or view_quaternion() along with
zoom_factor(). Other Coot windows could be configured to poll the primary to
get the view. This works but blocks the main thread. Here's the code:
------START
import SimpleHTTPServer
import SocketServer
class CustomHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
# code omitted for clarity. It simply returns JSON for the current
view_matrix()
server = SocketServer.TCPServer(("", 5309), CustomHTTPRequestHandler)
server.serve_forever()
------END
I figured that I could get this code to run in a separate thread thus not
blocking the main Coot window by using the threading package like so:
------START
import SimpleHTTPServer
import SocketServer
import threading
class CustomHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
# code omitted for clarity. It simply returns JSON for the current
view_matrix()
server = SocketServer.TCPServer(("", 5309), CustomHTTPRequestHandler)
thread = threading.Thread(target=server.serve_forever)
thread.daemon = True
thread.start()
------END
The thread seems to start, but it gets paused immediately and no longer
responds. Any ideas how to include a simple HTTP server within Coot?
-Chip
########################################################################
To unsubscribe from the COOT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=COOT&A=1
This message was issued to members of www.jiscmail.ac.uk/COOT, a mailing list
hosted by www.jiscmail.ac.uk, terms & conditions are available at
https://www.jiscmail.ac.uk/policyandsecurity/