(self, callback, *userdata)
| 251 | self.link_to.do = self.do |
| 252 | |
| 253 | def do(self, callback, *userdata): |
| 254 | if self.plc_instance and (callback is None): |
| 255 | print("removing connection to the PLC") |
| 256 | self.plc_instance.remove_link_to(self) |
| 257 | self.plc_instance = None |
| 258 | |
| 259 | if hasattr(self.link_to.event_method_bound, '_js_code'): |
| 260 | self.link_to.event_source_instance.attributes[self.link_to.event_name] = self.link_to.event_method_bound._js_code%{ |
| 261 | 'emitter_identifier':self.link_to.event_source_instance.identifier, 'event_name':self.link_to.event_name} |
| 262 | self.link_to.callback = callback |
| 263 | self.link_to.userdata = userdata |
| 264 | self.link_to.kwuserdata = {} |
| 265 | #here the callback is called immediately to make it possible link to the plc |
| 266 | if callback is not None: #protection against the callback replacements in the editor |
| 267 | callback(self, *userdata) |
| 268 | |
| 269 | @decorate_set_on_listener("(self, emitter)") |
| 270 | @decorate_event |
no test coverage detected