forked from bartvdbraak/blender
change for sorting rna cleaner (was broken), diff's on rna_properties.txt will stop being so big now.
This commit is contained in:
parent
3a34d669e1
commit
e2a6a0b377
@ -109,6 +109,11 @@ def get_props_from_txt(input_filename):
|
||||
|
||||
props_list=[]
|
||||
props_length_max=[0,0,0,0,0,0,0,0]
|
||||
|
||||
done_text = "+"
|
||||
done = 0
|
||||
tot = 0
|
||||
|
||||
for line in file_lines:
|
||||
|
||||
# debug
|
||||
@ -141,8 +146,8 @@ def get_props_from_txt(input_filename):
|
||||
# type, description
|
||||
try:
|
||||
[btype, description] = tail.split(None, 1)
|
||||
if '"' in description:
|
||||
description.replace('"', "'")
|
||||
# make life easy and strip quotes
|
||||
description = description.replace("'", "").replace('"', "").replace("\\", "").strip()
|
||||
except ValueError:
|
||||
[btype, description] = [tail,'NO DESCRIPTION']
|
||||
|
||||
@ -153,10 +158,16 @@ def get_props_from_txt(input_filename):
|
||||
changed = check_if_changed(bfrom, bto)
|
||||
|
||||
# lists formatting
|
||||
props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, repr(description)]
|
||||
props=[comment, changed, bclass, bfrom, bto, kwcheck, btype, description]
|
||||
props_list.append(props)
|
||||
props_length_max=list(map(max,zip(props_length_max,list(map(len,props)))))
|
||||
|
||||
if done_text in comment:
|
||||
done += 1
|
||||
tot += 1
|
||||
|
||||
print("Total done %.2f" % (done / tot * 100.0) )
|
||||
|
||||
return (props_list,props_length_max)
|
||||
|
||||
|
||||
@ -243,15 +254,15 @@ def write_files(basename, props_list, props_length_max):
|
||||
for props in props_list:
|
||||
#txt
|
||||
if props[0] != '': txt += '%s * ' % props[0] # comment
|
||||
txt += '%s.%s -> %s: %s %s\n' % tuple(props[2:5] + props[6:]) # skipping keyword-check
|
||||
txt += '%s.%s -> %s: %s "%s"\n' % tuple(props[2:5] + props[6:]) # skipping keyword-check
|
||||
# rna_api
|
||||
if props[0] == 'NOTE': indent = '# '
|
||||
else: indent = ' '
|
||||
rna += indent + '("%s", "%s", "%s", "%s", %s),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted
|
||||
rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted
|
||||
# py
|
||||
blanks = [' '* (x[0]-x[1]) for x in zip(props_length_max,list(map(len,props)))]
|
||||
props = [('"%s"%s' if props[-1] != x[0] else "%s%s") % (x[0],x[1]) for x in zip(props,blanks)]
|
||||
py += indent + '(%s, %s, %s, %s, %s, %s, %s, %s),\n' % tuple(props)
|
||||
py += indent + '(%s, %s, %s, %s, %s, %s, %s, "%s"),\n' % tuple(props)
|
||||
|
||||
f_txt.write(txt)
|
||||
f_py.write("rna_api = [\n%s]\n" % py)
|
||||
@ -275,7 +286,7 @@ def main():
|
||||
global sort_choices, default_sort_choice
|
||||
global kw_prefixes, kw
|
||||
|
||||
sort_choices = ['note','changed','class','from','to','kw', 'class.from']
|
||||
sort_choices = ['note','changed','class','from','to','kw', 'class.to']
|
||||
default_sort_choice = sort_choices[-1]
|
||||
kw_prefixes = [ 'active','apply','bl','exclude','has','invert','is','lock', \
|
||||
'pressed','show','show_only','use','use_only','layers','states', 'select']
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user