|
|
@@ -14,6 +14,7 @@ import argparse |
|
|
|
import abp |
|
|
|
import json |
|
|
|
from pkg_resources import resource_filename |
|
|
|
from pprint import pprint |
|
|
|
import time |
|
|
|
|
|
|
|
clients = [] |
|
|
@@ -22,7 +23,7 @@ local_state = abp.GraphState() |
|
|
|
def process_edit(edit, client, server): |
|
|
|
action = edit["action"] |
|
|
|
|
|
|
|
print edit |
|
|
|
pprint(edit) |
|
|
|
|
|
|
|
if action == "create": |
|
|
|
local_state.add_qubit(edit["name"], position=edit["position"], vop=0) |
|
|
@@ -45,9 +46,7 @@ def process_edit(edit, client, server): |
|
|
|
|
|
|
|
def new_message(client, server, message): |
|
|
|
if message.startswith("edit:"): |
|
|
|
print message[5:] |
|
|
|
edit = json.loads(message[5:]) |
|
|
|
print "Received update from javascript." |
|
|
|
process_edit(edit, client, server) |
|
|
|
else: |
|
|
|
print "Received update from python {}.".format(client["id"]) |
|
|
|