diff --git a/base.py b/base.py index fb31d77..df5cb31 100644 --- a/base.py +++ b/base.py @@ -60,10 +60,10 @@ class Client(HandlerBase): def change_callback(dictionary=self.dictionary, kind_uri=(kind, uri)): dictionary.pop(kind_uri, None) - node = server.interactor_classes[kind](uri, self.node_map, change_callback) + node = server.interactor_classes[kind](uri, change_callback) self.dictionary[kind, uri] = node - + node.update_node_map(self.node_map) self.nodes[uri] = node self.server = server self.instrument_name = instrument_name diff --git a/secop.py b/secop.py index 0614aaf..8ebc1c3 100644 --- a/secop.py +++ b/secop.py @@ -49,7 +49,7 @@ class SecopInteractor(SecopClient): hide_par = ["baseclass", "class", "pollinterval"] skip_par = ["status2"] - def __init__(self, uri, node_map, change_callback=None): + def __init__(self, uri, change_callback=None): super().__init__(uri) self.module_updates = set() self.param_updates = set() @@ -57,11 +57,13 @@ class SecopInteractor(SecopClient): self.change_callback = change_callback try: self.connect() - node_map.update({k: self for k in self.modules}) self.register_callback(None, updateItem=self.updateItem, descriptiveDataChange=self.descChanged) except Exception as e: print(repr(e)) + def update_node_map(self, node_map): + node_map.update({k: self for k in self.modules}) + def descChanged(self, module, desc): if module is None and self.change_callback: self.change_callback()