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