Преглед на файлове

Threaded HTTP server -> no laggy refresh

master
Pete Shadbolt преди 8 години
родител
ревизия
452430627a
променени са 4 файла, в които са добавени 14 реда и са изтрити 9 реда
  1. +5
    -1
      abp/server.py
  2. +7
    -7
      static/index.html
  3. +1
    -0
      static/main.css
  4. +1
    -1
      static/scripts/materials.js

+ 5
- 1
abp/server.py Целия файл

@@ -1,6 +1,7 @@
from websocket_server import WebsocketServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn
import os, sys, threading
import webbrowser
import argparse
@@ -19,6 +20,9 @@ def client_left(client, server):
print "Client {} disconnected.".format(client["id"])
clients.remove(client)

class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
""" Handle requests in a separate thread """

if __name__ == '__main__':
parser = argparse.ArgumentParser(description = "ABP websocket server")
parser.add_argument("-v", action="store_false", help="Launch browser")
@@ -29,7 +33,7 @@ if __name__ == '__main__':
os.chdir(where)

# Start the HTTP server
httpserver = HTTPServer(('', 5001), SimpleHTTPRequestHandler)
httpserver = ThreadedHTTPServer(('', 5001), SimpleHTTPRequestHandler)
thread = threading.Thread(target = httpserver.serve_forever)
thread.daemon = True
thread.start()


+ 7
- 7
static/index.html Целия файл

@@ -26,15 +26,15 @@
<div id=server_info class=hidden> </div>

<div id=node_data class=hidden>
<h3 id=node_name></h3>
<div id=node_name></div>
<ul>
<li id=node_vop></li>
<li><a href="#">Measure in X</a></li>
<li><a href="#">Measure in Y</a></li>
<li><a href="#">Measure in Z</a></li>
<li><a href="#">Act Hadamard</a></li>
<li><a href="#">Act Phase</a></li>
<li><a href="#" onclick="editor.localComplementation()">Invert neighbourhood</a></li>
<!--<li><a href="#">Measure in X</a></li>-->
<!--<li><a href="#">Measure in Y</a></li>-->
<!--<li><a href="#">Measure in Z</a></li>-->
<!--<li><a href="#">Act Hadamard</a></li>-->
<!--<li><a href="#">Act Phase</a></li>-->
<!--<li><a href="#" onclick="editor.localComplementation()">Invert neighbourhood</a></li>-->
<!--<li>-->
<!--<a href="#">IA</a>-->
<!--<a href="#">IB</a>-->


+ 1
- 0
static/main.css Целия файл

@@ -47,6 +47,7 @@ ul {

li{
padding:3px;
padding-left: 0em;
}




+ 1
- 1
static/scripts/materials.js Целия файл

@@ -14,7 +14,7 @@ materials.prepare = function() {
linewidth: 2
});
materials.qubit = new THREE.PointsMaterial({
size: 0.5,
size: 0.3,
map: ballSprite,
alphaTest: 0.5,
transparent: true,


Loading…
Отказ
Запис