Parcourir la source

Now I can do CZ gates. Focus sucks though.

master
Pete Shadbolt il y a 8 ans
Parent
révision
5567258c53
2 fichiers modifiés avec 16 ajouts et 4 suppressions
  1. +4
    -2
      abp/static/scripts/editor.js
  2. +12
    -2
      bin/abpserver

+ 4
- 2
abp/static/scripts/editor.js Voir le fichier

@@ -47,8 +47,9 @@ editor.addQubitAtPoint = function(point) {
return;
}
point.round();
var new_node = Math.floor(point.x*1000000 + point.y*1000 + point.z);
var new_node = Math.floor(point.x) + "," + Math.floor(point.y) + "," + Math.floor(point.z);
websocket.edit({action:"create", name:new_node, position: point});
editor.focus(new_node);
gui.serverMessage("Created node " + new_node +".");
};

@@ -69,7 +70,8 @@ editor.onShiftClick = function() {
if (found === undefined){ return; }
if (editor.selection === undefined){ return; }
if (found === editor.selection){ return; }
abj.act_cz(found, editor.selection);
//abj.act_cz(found, editor.selection);
websocket.edit({action:"cz", start:found, end:editor.selection});
editor.focus(found);
gui.serverMessage("Acted CZ between " + found + " & " + editor.selection + ".");
graph.update();


+ 12
- 2
bin/abpserver Voir le fichier

@@ -20,9 +20,19 @@ local_state = abp.GraphState()

def process_edit(edit, server):
action = edit["action"]

print edit

print local_state.node.keys()

if action == "create":
local_state.add_qubit(edit["name"], position=edit["position"])
server.send_message_to_all(json.dumps(local_state.to_json()))
print type(edit["name"])
local_state.add_qubit(edit["name"], position=edit["position"], vop=0)
if action == "cz":
local_state.act_cz(edit["start"], edit["end"])

server.send_message_to_all(json.dumps(local_state.to_json()))



def new_message(client, server, message):


Chargement…
Annuler
Enregistrer