浏览代码

Oh my god sys.path[0] is so good

master
Pete Shadbolt 9 年前
父节点
当前提交
682e630353
共有 6 个文件被更改,包括 8 次插入8 次删除
  1. +0
    -0
      abp/graphstate.py
  2. +4
    -4
      abp/server.py
  3. +1
    -1
      abp/viz.py
  4. +1
    -1
      tests/test_graph.py
  5. +1
    -1
      tests/test_json.py
  6. +1
    -1
      tests/test_viz.py

abp/graph.py → abp/graphstate.py 查看文件


+ 4
- 4
abp/server.py 查看文件

@@ -7,7 +7,7 @@ import json
import threading import threading
import time import time
import os import os
from graph import GraphState
from graphstate import GraphState




class VizHandler(SimpleHTTPRequestHandler): class VizHandler(SimpleHTTPRequestHandler):
@@ -18,7 +18,7 @@ class VizHandler(SimpleHTTPRequestHandler):
SimpleHTTPRequestHandler.__init__(self, *args, **kwargs) SimpleHTTPRequestHandler.__init__(self, *args, **kwargs)


def get_state(self): def get_state(self):
""" Get the current graph state """
""" Get the current graphstate state """
self.send_response(200) self.send_response(200)
self.send_header('Content-Type', 'application/json') self.send_header('Content-Type', 'application/json')
self.end_headers() self.end_headers()
@@ -77,13 +77,13 @@ def demograph():




if __name__ == '__main__': if __name__ == '__main__':
os.chdir("/home/pete/physics/abp/static")
where = os.path.join(sys.path[0], "../static")
os.chdir(where)
server = Server() server = Server()
server.start() server.start()


g = demograph() g = demograph()



while True: while True:
server.update(g) server.update(g)
time.sleep(1) time.sleep(1)


+ 1
- 1
abp/viz.py 查看文件

@@ -2,7 +2,7 @@ import networkx as nx
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
import clifford import clifford
import numpy as np import numpy as np
from graph import GraphState
from graphstate import GraphState


VOP_COLORS = ["red", "green", "blue", "orange", "yellow", "purple", "black", "white"] VOP_COLORS = ["red", "green", "blue", "orange", "yellow", "purple", "black", "white"]




+ 1
- 1
tests/test_graph.py 查看文件

@@ -1,4 +1,4 @@
from abp.graph import GraphState, DiffedGraphState
from abp.graphstate import GraphState, DiffedGraphState
from abp import clifford from abp import clifford
import time import time




+ 1
- 1
tests/test_json.py 查看文件

@@ -1,4 +1,4 @@
from abp.graph import GraphState, DiffedGraphState
from abp.graphstate import GraphState, DiffedGraphState
from abp import clifford from abp import clifford
import time import time
import json import json


+ 1
- 1
tests/test_viz.py 查看文件

@@ -1,4 +1,4 @@
from abp.graph import GraphState
from abp.graphstate import GraphState
from abp import viz from abp import viz






正在加载...
取消
保存