浏览代码

We did need one of those functions.

master
Pete Shadbolt 8 年前
父节点
当前提交
fed7813eb3
共有 2 个文件被更改,包括 16 次插入3 次删除
  1. +14
    -0
      abp/static/scripts/anders_briegel.js
  2. +2
    -3
      bin/abpserver

+ 14
- 0
abp/static/scripts/anders_briegel.js 查看文件

@@ -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 查看文件

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


正在加载...
取消
保存