On 04/19/2007 08:32 AM, Dirk Meyer wrote:
> BTW, that looks stupid:
>
> | #
> | # Begin Group: Video | Item | [0]
> | #
> | 
> | # Path of the directory / file.
> | # Default: 
> | video.items[0].path = $(HOME)/video
> | 
> | # Name in the mediamenu
> | # Default: 
> | video.items[0].name = My Home Videos
> | 
> | #
> | # End Group: Video | Item | [0]
> | #
> | 
> | #
> | # Begin Group: Video | Item | [1]
> | #
> | 
> | # Path of the directory / file.
> | # Default: 
> | video.items[1].path = /local/video/trailer
> | 
> | # Name in the mediamenu
> | # Default: 
> | video.items[1].name = Trailer
> | 
> | #
> | # End Group: Video | Item | [1]
> | #
> | 
> | #
> | # Begin Group: Video | Item | [2]
> | #
> | 
> | # Path of the directory / file.
> | # Default: 
> | video.items[2].path = /local/video/recordings
> | 
> | # Name in the mediamenu
> | # Default: 
> | video.items[2].name = Recordings
> | 
> | #
> | # End Group: Video | Item | [2]
> | #
>   

I'm thinking for Lists and Dicts instead of having the comment above
each variable in each item in the list, we document the description for
each variable when we begin the list description.  So for example, from
base/test/config.py, we have:

    # create a list of a group
    l = List(desc='desrc of list subsubgroup', schema=Group([
        Var(name='a', type=int, desc='desc a', default=3 ),
        # z is again a group
        Group(name='z', desc='this is a subgroup', schema=[
        Var(name='x', desc='desc_x', default=7 ),
        Var(name='y', type=range(0,5), desc='desc_y', default=3 ) ]) ]))
    subgroup.add_variable('list', l)
      

This currently (or did before I screwed things up) results in this output:

    # desc a
    subgroup.list[0].a = 6

    #
    # subgroup.list[0].z
    # this is a subgroup
    #

    # desc_x
    # subgroup.list[0].z.x = 7

    # desc_y
    # subgroup.list[0].z.y = 3

    # desc a
    # subgroup.list[1].a = 3

    #
    # subgroup.list[1].z
    # this is a subgroup
    #

    # desc_x
    subgroup.list[1].z.x = 8

    # desc_y
    # subgroup.list[1].z.y = 3
      


So about we change this to outputting:

    # Begin List: Subgroup | List
    # descr of list subgroup
    # 
    # Each item in the list takes the following variables:
    #    a - desc a
    #    z - this is a subgroup
    #        Group 'z' takes the following variables:
    #           x - desc_x
    #           y - desc_y

    subgroup.list[0].a = 6
    # subgroup.list[0].z.x = 7
    # subgroup.list[0].z.y = 3

    # subgroup.list[1].a = 3
    subgroup.list[1].z.x = 8
    subgroup.list[1].z.y = 3
      


It'd be nice if we could use the new implicit indexing ([]) for the
above but I don't see how that's possible.  Unless we used a new syntax
like:

    subgroup.list[] = {
       a = 6
       # z.x = 7
       # z.y = 3
    }
    subgroup.list[] = {
       # a = 3
       z.x = 8
       z.y = 3
    }
      

I don't entirely disfavor that.

Comments?


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to