Procházet zdrojové kódy

Move some files, comment visiblegraphstate

master
Pete Shadbolt před 8 roky
rodič
revize
eb4fe7d81e
15 změnil soubory, kde provedl 10 přidání a 10 odebrání
  1. +1
    -5
      abp/server.py
  2. +9
    -5
      abp/visiblegraphstate.py
  3. +0
    -0
      client/anders_briegel.js
  4. +0
    -0
      client/api.js
  5. +0
    -0
      client/curve.js
  6. +0
    -0
      client/graph.js
  7. +0
    -0
      client/index.html
  8. +0
    -0
      client/interaction.js
  9. +0
    -0
      client/libs.js
  10. +0
    -0
      client/main.css
  11. +0
    -0
      client/main.js
  12. +0
    -0
      client/materials.js
  13. +0
    -0
      client/poll.js
  14. +0
    -0
      client/tables.js
  15. +0
    -0
      client/three.js

server/server.py → abp/server.py Zobrazit soubor

@@ -4,10 +4,6 @@ import abp
import json

clients = []
state = abp.VisibleGraphState()

def compute_diff(decoded_message):


def new_message(client, server, message):
decoded_message = json.loads(message)
@@ -29,7 +25,7 @@ def client_left(client, server):
clients.remove(client)

if __name__ == '__main__':
server = WebsocketServer(5001)
server = WebsocketServer(5000)
server.set_fn_new_client(new_client)
server.set_fn_message_received(new_message)
server.set_fn_client_left(client_left)

+ 9
- 5
abp/visiblegraphstate.py Zobrazit soubor

@@ -9,25 +9,29 @@ from websocket import create_connection
from graphstate import GraphState
import json


class VisibleGraphState(GraphState):

""" Overloads the graph state with methods for sending to the browser over a websocket """

def __init__(self, *args, **kwargs):
""" Constructor """
GraphState.__init__(self, *args, **kwargs)
self.ws = create_connection("ws://localhost:5001")
self.ws = create_connection("ws://localhost:5000")
atexit.register(self.shutdown)
#self.ws.send(json.dumps({"method":"clear"}))

def shutdown(self):
""" The client should shut down automatically on close """
self.update()
self.ws.close()

def to_json(self):
ngbh = {a: {b : True for b in self.ngbh[a]}
""" We override to_json() so that we send the whole `ngbh` structure in JS-friendly form """
ngbh = {a: {b: True for b in self.ngbh[a]}
for a in self.ngbh}
return {"vops": self.vops, "ngbh": ngbh, "meta": self.meta}

def update(self):
""" Call this function when you are ready to send data to the browser """
data = json.dumps(self.to_json())
self.ws.send(data)



server/anders_briegel.js → client/anders_briegel.js Zobrazit soubor


server/api.js → client/api.js Zobrazit soubor


server/curve.js → client/curve.js Zobrazit soubor


server/graph.js → client/graph.js Zobrazit soubor


server/index.html → client/index.html Zobrazit soubor


server/interaction.js → client/interaction.js Zobrazit soubor


server/libs.js → client/libs.js Zobrazit soubor


server/main.css → client/main.css Zobrazit soubor


server/main.js → client/main.js Zobrazit soubor


server/materials.js → client/materials.js Zobrazit soubor


server/poll.js → client/poll.js Zobrazit soubor


server/tables.js → client/tables.js Zobrazit soubor


server/three.js → client/three.js Zobrazit soubor


Načítá se…
Zrušit
Uložit