Bläddra i källkod

We did need one of those functions.

master
Pete Shadbolt 8 år sedan
förälder
incheckning
fed7813eb3
2 ändrade filer med 16 tillägg och 3 borttagningar
  1. +14
    -0
      abp/static/scripts/anders_briegel.js
  2. +2
    -3
      bin/abpserver

+ 14
- 0
abp/static/scripts/anders_briegel.js Visa fil

@@ -56,4 +56,18 @@ abj.order = function(){
return Object.keys(abj.node).length;
};

abj.edgelist = function() {
var seen = {};
var output = [];
for (var i in abj.adj) {
for (var j in abj.adj[i]) {
if (!Object.prototype.hasOwnProperty.call(seen, j)) {
output.push([i, j]);
}
}
seen[i] = true;
}
return output;
};



+ 2
- 3
bin/abpserver Visa fil

@@ -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"])


Laddar…
Avbryt
Spara