MCPcopy Index your code
hub / github.com/rawpython/remi / add_child

Method add_child

remi/gui.py:444–473  ·  view source on GitHub ↗

Adds a child to the Tag To retrieve the child call get_child or access to the Tag.children[key] dictionary. Args: key (str): Unique child's identifier, or iterable of keys value (Tag, str): can be a Tag, an iterable of Tag or a str. In case of iterable

(self, key, value)

Source from the content-addressed store, hash-verified

442 self.attributes['class'] = ''
443
444 def add_child(self, key, value):
445 """Adds a child to the Tag
446
447 To retrieve the child call get_child or access to the Tag.children[key] dictionary.
448
449 Args:
450 key (str): Unique child's identifier, or iterable of keys
451 value (Tag, str): can be a Tag, an iterable of Tag or a str. In case of iterable
452 of Tag is a dict, each item's key is set as 'key' param
453 """
454 if type(value) in (list, tuple, dict):
455 if type(value) == dict:
456 for k in value.keys():
457 self.add_child(k, value[k])
458 return
459 i = 0
460 for child in value:
461 self.add_child(key[i], child)
462 i = i + 1
463 return
464
465 if hasattr(value, 'attributes'):
466 value.attributes['data-parent-widget'] = self.identifier
467 value._parent = self
468
469 if key in self.children:
470 self._render_children_list.remove(key)
471 self._render_children_list.append(key)
472
473 self.children[key] = value
474
475 def get_child(self, key):
476 """Returns the child identified by 'key'

Callers 15

mainMethod · 0.95
mainMethod · 0.80
set_valueMethod · 0.80
appendMethod · 0.80
__init__Method · 0.80
set_icon_fileMethod · 0.80
set_icon_dataMethod · 0.80
set_internal_jsMethod · 0.80
set_titleMethod · 0.80
appendMethod · 0.80
appendMethod · 0.80
set_textMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected