[1151] | 1 | import frams |
---|
| 2 | import sys |
---|
| 3 | |
---|
| 4 | frams.init(*(sys.argv[1:])) |
---|
| 5 | |
---|
| 6 | def printSingleProperty(v,p): |
---|
| 7 | print(' %s "%s" type="%s" flags=%d group=%d help="%s"' % (v._propId(p),v._propName(p),v._propType(p),v._propFlags(p),v._propGroup(p),v._propHelp(p))) |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | def printFramsProperties(v): |
---|
| 11 | N=v._propCount() |
---|
| 12 | G=v._groupCount() |
---|
| 13 | if G<2: |
---|
| 14 | |
---|
| 15 | #no groups, simply iterate all props |
---|
| 16 | |
---|
| 17 | print("'%s' has %d properties" % (v._class(),v._propCount())) |
---|
| 18 | for p in range(v._propCount()): |
---|
| 19 | printSingleProperty(v,p) |
---|
| 20 | |
---|
| 21 | else: |
---|
| 22 | |
---|
| 23 | #iterate through groups and iterate all props in a group. |
---|
| 24 | #why the distinction? |
---|
| 25 | #first, just to show there are two ways. there is always at least one |
---|
| 26 | #group so you can always get all props by iterating the group. |
---|
| 27 | #second, groups actually do not exist as collections. iterating in |
---|
| 28 | #groups works by checking all properties on each iteration and |
---|
| 29 | #testing which one is the m-th property of the group. |
---|
| 30 | #these inefficient _memberCount() and _groupMember() are provided |
---|
| 31 | #for the sake of completeness but don't use them without good reason ;-) |
---|
| 32 | |
---|
| 33 | print("'%s' has %d properties in %d group(s)" % (v._class(),v._propCount(),v._groupCount())) |
---|
| 34 | for g in range(G): |
---|
| 35 | print('\n=========== Group #%d: %s ==========' % (g,v._groupName(g))) |
---|
| 36 | for m in range(v._memberCount(g)): |
---|
| 37 | p=v._groupMember(g,m) |
---|
| 38 | printSingleProperty(v,p) |
---|
| 39 | print('========================\n') |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | printFramsProperties(frams.World) |
---|
| 45 | |
---|
| 46 | printFramsProperties(frams.GenePools[0].add('X')) |
---|