openalea.core.control package#

Submodules#

openalea.core.control.all module#

openalea.core.control.control module#

Control

class openalea.core.control.control.Control(name, interface=None, value=None, widget=None, constraints=None, **kwds)[source]#

Bases: Observed

A Control is an observable variable with
  • name

  • interface

  • constraints on values

property default#
get_input_port(name=None)[source]#
get_label()[source]#
property identifier#
property interface#
property label#
property name#
notify_change()[source]#

Send value_changed event

rename(name)[source]#
Parameters:

name (basestring) – new name

reset()[source]#
set_input(key, val=None, notify=True)[source]#
set_value(value)[source]#

TODO: CPL: To discuss !!!! Deepcopy or not ? Currently, standard python behaviour: copy for non mutable else reference

property value#

openalea.core.control.manager module#

class openalea.core.control.manager.ControlContainer[source]#

Bases: Observed, AbstractListener

>>> from openalea.core.control.manager import ControlContainer
add(name, **kwds)[source]#

Convenience method to create a control and add it to container. See Control.

>>> container = ControlContainer()
>>> container.add('i', interface='IInt', value=1)
Control('i', IInt, value=1)
Parameters:
  • name – Control name

  • kwds – Control keywords like interface, value, …

add_control(control)[source]#
Parameters:

control – Control object

changed()[source]#

Like namespace() but dictionnary contains only controls with value different than default value.

clear()[source]#
clear_followers()[source]#
control(name=None, uid=None)[source]#

Return all control with name “name”. If no control found, returns None, if only one found, returns it else return a list of control.

If uid is passed, returns corresponding control or None if not found. If uid is passed, it never returns a list as uid is unique.

controls()[source]#

Returns a list of Control objects.

disable_followers()[source]#
enable_followers()[source]#
namespace(interface=None)[source]#

Returns namespace (dict control name -> value). :param tag: returns namespace corresponding to given tag.

Default, returns global namespace

notify(sender, event)[source]#

This function is called by observed objects

Parameters:
  • sender – the observed object which send notification

  • event – the data associated to the notification

register_follower(name, func)[source]#
remove_control(control)[source]#
Parameters:

control – Control object

unregister_follower(name)[source]#
update(dic)[source]#

Update controls with dict values. If a name is not referenced in ControlContainer, nothing is done.

Note

Example:

Let “container” a Container with one control “a” with value 1:

container:
    - a:IInt = 1

after container.update({‘a’:2, ‘b’:3}) we get

container:
  • a:IInt = 2

Parameters:

dicdict name -> value

class openalea.core.control.manager.ControlManager(*args, **kw)[source]#

Bases: ControlContainer

class openalea.core.control.manager.Follower(name, func)[source]#

Bases: AbstractListener

follow_events()[source]#
ignore_events()[source]#
notify(*args, **kwargs)#

This function is called by observed objects

Parameters:
  • sender – the observed object which send notification

  • event – the data associated to the notification

openalea.core.control.manager.control_dict()[source]#

Get the controls from the control manager in a dictionary (key = name, value = object)

Returns:

dict of controls

openalea.core.control.pyserial module#

openalea.core.control.pyserial.save_controls(controls, filename)[source]#
openalea.core.control.pyserial.serialize_controls(controls)[source]#

openalea.core.control.serialization module#

class openalea.core.control.serialization.ControlDeserializer[source]#

Bases: AbstractDeserializer

deserialize(lines, protocol=None, **kwds)[source]#
class openalea.core.control.serialization.ControlLoader[source]#

Bases: AbstractLoader

dtype = 'IControl'#
protocols = ['text/x-python']#
class openalea.core.control.serialization.ControlSaver[source]#

Bases: AbstractSaver

dtype = 'IControl'#
protocols = ['text/x-python']#
class openalea.core.control.serialization.ControlSerializer[source]#

Bases: object

serialize(obj, protocol=None, **kwds)[source]#

Module contents#