Skip to content

Commit

Permalink
Updates due to refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tcstewar committed Jul 24, 2015
1 parent edc3d29 commit 375aefc
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions nengo_gui/components/htmlview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@
import nengo
import numpy as np

from nengo_gui.components.component import Component, Template
from nengo_gui.components.component import Component


class HTMLView(Component):
def __init__(self, viz, config, uid, obj):
super(HTMLView, self).__init__(viz, config, uid)
def __init__(self, obj):
super(HTMLView, self).__init__()
self.obj = obj
self.obj_output = obj.output
self.label = viz.viz.get_label(obj)
self.data = collections.deque()

def add_nengo_objects(self, viz):
with viz.model:
def attach(self, page, config, uid):
super(HTMLView, self).attach(page, config, uid)
self.label = page.get_label(self.obj)

def add_nengo_objects(self, page):
with page.model:
self.obj.output = self.gather_data

def remove_nengo_objects(self, viz):
def remove_nengo_objects(self, page):
self.obj.output = self.obj_output

def gather_data(self, t, *x):
Expand All @@ -34,10 +37,9 @@ def update_client(self, client):
client.write(item)

def javascript(self):
info = dict(uid=self.uid, label=self.label)
info = dict(uid=id(self), label=self.label)
json = self.javascript_config(info)
return 'new Nengo.HTMLView(main, sim, %s);' % json

class HTMLViewTemplate(Template):
cls = HTMLView
config_params = dict(**Template.default_params)
def code_python_args(self, uids):
return [uids[self.obj]]

0 comments on commit 375aefc

Please sign in to comment.