def clear_namespace(self, interpreter, project): if project is None: return sys.path = self.old_syspath for k in project.ns.keys() + ['world', 'data', 'project']: if k in interpreter.user_ns: del interpreter.user_ns[k] from openalea.core.world import World world = World() world.clear()
def add_objects_with_attributes_set(): """ Attributes are defined before adding object to world. Results is less signals sent by world """ world = World() world.clear() obj1 = WorldObject("obj1", 1) obj2 = WorldObject("obj2", 2) obj1.set_attribute('a1', 1, 'IInt', constraints=c1) obj1.set_attribute('a2', True, 'IBool') obj2.set_attribute('b1', 2.34, 'IFloat', constraints=c2) world["obj1"] = obj1 world["obj2"] = obj2