Quellcode durchsuchen

Move some files, comment visiblegraphstate

master
Pete Shadbolt vor 8 Jahren
Ursprung
Commit
eb4fe7d81e
15 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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 Datei anzeigen


server/api.js → client/api.js Datei anzeigen


server/curve.js → client/curve.js Datei anzeigen


server/graph.js → client/graph.js Datei anzeigen


server/index.html → client/index.html Datei anzeigen


server/interaction.js → client/interaction.js Datei anzeigen


server/libs.js → client/libs.js Datei anzeigen


server/main.css → client/main.css Datei anzeigen


server/main.js → client/main.js Datei anzeigen


server/materials.js → client/materials.js Datei anzeigen


server/poll.js → client/poll.js Datei anzeigen


server/tables.js → client/tables.js Datei anzeigen


server/three.js → client/three.js Datei anzeigen


Laden…
Abbrechen
Speichern