It is used to automatically represent the object to HTML format packs all the attributes, children and so on. Args: changed_widgets (dict): A dictionary containing a collection of tags that have to be updated. The tag that have to be updated is the key, a
(self, changed_widgets=None)
| 358 | return ret |
| 359 | |
| 360 | def repr(self, changed_widgets=None): |
| 361 | """It is used to automatically represent the object to HTML format |
| 362 | packs all the attributes, children and so on. |
| 363 | |
| 364 | Args: |
| 365 | changed_widgets (dict): A dictionary containing a collection of tags that have to be updated. |
| 366 | The tag that have to be updated is the key, and the value is its textual repr. |
| 367 | """ |
| 368 | if changed_widgets is None: |
| 369 | changed_widgets = {} |
| 370 | local_changed_widgets = {} |
| 371 | _innerHTML = self.innerHTML(local_changed_widgets) |
| 372 | |
| 373 | if self._ischanged() or (len(local_changed_widgets) > 0): |
| 374 | self._backup_repr = ''.join(('<', self.type, ' ', self._repr_attributes, '>', |
| 375 | _innerHTML, '</', self.type, '>')) |
| 376 | # faster but unsupported before python3.6 |
| 377 | # self._backup_repr = f'<{self.type} {self._repr_attributes}>{_innerHTML}</{self.type}>' |
| 378 | if self._ischanged(): |
| 379 | # if self changed, no matter about the children because will be updated the entire parent |
| 380 | # and so local_changed_widgets is not merged |
| 381 | changed_widgets[self] = self._backup_repr |
| 382 | self._set_updated() |
| 383 | else: |
| 384 | changed_widgets.update(local_changed_widgets) |
| 385 | return self._backup_repr |
| 386 | |
| 387 | def _need_update(self, emitter=None, child_ignore_update=False): |
| 388 | # if there is an emitter, it means self is the actual changed widget |