##// END OF EJS Templates
allowing widet id to be set externally
Sylvain Corlay -
Show More
@@ -119,6 +119,7 b' class Widget(LoggingConfigurable):'
119 119 #-------------------------------------------------------------------------
120 120 def __init__(self, **kwargs):
121 121 """Public constructor"""
122 self._model_id = kwargs.pop('model_id', None)
122 123 super(Widget, self).__init__(**kwargs)
123 124
124 125 self.on_trait_change(self._handle_property_changed, self.keys)
@@ -136,8 +137,11 b' class Widget(LoggingConfigurable):'
136 137 def open(self):
137 138 """Open a comm to the frontend if one isn't already open."""
138 139 if self.comm is None:
139 # Create a comm.
140 self.comm = Comm(target_name=self._model_name)
140 if self._model_id is None:
141 self.comm = Comm(target_name=self._model_name)
142 self._model_id = self.model_id
143 else:
144 self.comm = Comm(target_name=self._model_name, comm_id=self._model_id)
141 145 self.comm.on_msg(self._handle_msg)
142 146 Widget.widgets[self.model_id] = self
143 147
General Comments 0
You need to be logged in to leave comments. Login now