def remove_self(self): """Remove the element from its own parent""" elementid, parent = summon_core.get_element_parent(self.ptr) if parent == 0: raise Exception("element has no parent, cannot remove") else: summon_core.remove_group2(parent, self.ptr)
def get_parent(self): """Returns the parent of this element or None if no parent exists""" elementid, parent = summon_core.get_element_parent(self.ptr) if parent == 0: return None else: return _make_ref(elementid, parent)
def replace_self(self, newelm): """Replace the element with a new element""" elementid, parent = summon_core.get_element_parent(self.ptr) if parent == 0: raise Exception("element has no parent, cannot replace") else: summon_core.replace_group2(parent, self.ptr, newelm) return newelm