Show More
@@ -123,6 +123,7 b' class Widget(LoggingConfigurable):' | |||||
123 |
|
123 | |||
124 | self.on_trait_change(self._handle_property_changed, self.keys) |
|
124 | self.on_trait_change(self._handle_property_changed, self.keys) | |
125 | Widget._call_widget_constructed(self) |
|
125 | Widget._call_widget_constructed(self) | |
|
126 | self.open() | |||
126 |
|
127 | |||
127 | def __del__(self): |
|
128 | def __del__(self): | |
128 | """Object disposal""" |
|
129 | """Object disposal""" | |
@@ -137,6 +138,11 b' class Widget(LoggingConfigurable):' | |||||
137 | """Gets the Comm associated with this widget. |
|
138 | """Gets the Comm associated with this widget. | |
138 |
|
139 | |||
139 | If a Comm doesn't exist yet, a Comm will be created automagically.""" |
|
140 | If a Comm doesn't exist yet, a Comm will be created automagically.""" | |
|
141 | self.open() | |||
|
142 | return self._comm | |||
|
143 | ||||
|
144 | def open(self): | |||
|
145 | """Open a comm to the frontend if one isn't already open.""" | |||
140 | if self._comm is None: |
|
146 | if self._comm is None: | |
141 | # Create a comm. |
|
147 | # Create a comm. | |
142 | self._comm = Comm(target_name=self._model_name) |
|
148 | self._comm = Comm(target_name=self._model_name) | |
@@ -145,8 +151,7 b' class Widget(LoggingConfigurable):' | |||||
145 |
|
151 | |||
146 | # first update |
|
152 | # first update | |
147 | self.send_state() |
|
153 | self.send_state() | |
148 | return self._comm |
|
154 | ||
149 |
|
||||
150 | @property |
|
155 | @property | |
151 | def model_id(self): |
|
156 | def model_id(self): | |
152 | """Gets the model id of this widget. |
|
157 | """Gets the model id of this widget. |
General Comments 0
You need to be logged in to leave comments.
Login now