Dynamic drop down menus in custom GUI panel


I’m working on the MORSE robotics simulator based on Blender 2.5.
We’re currently trying to implement a custom GUI for setting up simulation scenarios.

The problem at hand is creating a custom panel, in which users can configure each element in the scene (for instance, cameras, sensors, robots). We want an interface similar to the one for adding background images in the 3D view, where pressing the “Add Image” button will add more information boxes for each image.

We’ve done this, but now we have problems making a drop down list in each of this boxes, where the name of an object can be selected.
When creating the lists, I get an error of this kind:TypeError: bpy_struct: item.attr= val: ConfiguredComponent.component_list expected a string enum or a set of strings in (), not tuple
The part of the code that should create the lists is this:

class ConfiguredComponent(bpy.types.PropertyGroup):
    """ Custom class to hold the information of a component binding
    Will store the name of the component, and the middleware it is bound to
    name = bpy.props.StringProperty(name="name", default="")
    index = bpy.props.IntProperty(name="index", default=0)
    show_expanded = bpy.props.BoolProperty(name='show_expanded', description='View component bindings', default=True)
    component_list = bpy.props.EnumProperty(name='component_list', description='Choose a component', items=[])


def updateSceneComponents(co_co):
    """ Build a list of the active components in the scene """
    scene_component_list = []
    index = 0

    # Iterate over all objects in the scene
    for object in bpy.data.objects:
            scene_component_list.append((str(index), object.name, object.name))
            index = index + 1

    # Create an enum object, which will be used later
    component_enum = bpy.props.EnumProperty(name='component_enum', description='Choose a component', items=scene_component_list, default='0')

    # create an EnumProperty which can be used by the dropdown box
    #  to display the different scenes
    # NOTE: co_co is an instance of the ComponentConfig class
    co_co.component_list = component_enum

The error comes at the last line shown here.

Has anyone ever tried doing something like this?
What is the proper way of filling an enum field in a custom PropertyGroup class?
Any help will be greatly appreciated.


Gilberto Echeverria