forked from bartvdbraak/blender
Cleanup: pep8
This commit is contained in:
parent
3d7cf808b8
commit
ca983d1825
@ -239,7 +239,8 @@ def keyconfig_export(wm, kc, filepath):
|
|||||||
" except Exception as e:\n"
|
" except Exception as e:\n"
|
||||||
" print(\"Warning: %r\" % e)\n\n")
|
" print(\"Warning: %r\" % e)\n\n")
|
||||||
f.write("wm = bpy.context.window_manager\n")
|
f.write("wm = bpy.context.window_manager\n")
|
||||||
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
|
# keymap must be created by caller
|
||||||
|
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n")
|
||||||
|
|
||||||
# Generate a list of keymaps to export:
|
# Generate a list of keymaps to export:
|
||||||
#
|
#
|
||||||
@ -267,7 +268,8 @@ def keyconfig_export(wm, kc, filepath):
|
|||||||
km = km.active()
|
km = km.active()
|
||||||
|
|
||||||
f.write("# Map %s\n" % km.name)
|
f.write("# Map %s\n" % km.name)
|
||||||
f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
|
f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" %
|
||||||
|
(km.name, km.space_type, km.region_type, km.is_modal))
|
||||||
for kmi in km.keymap_items:
|
for kmi in km.keymap_items:
|
||||||
f.write(_kmistr(kmi, km.is_modal))
|
f.write(_kmistr(kmi, km.is_modal))
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
@ -542,6 +542,7 @@ class Sound(bpy_types.ID):
|
|||||||
|
|
||||||
|
|
||||||
class RNAMeta(type):
|
class RNAMeta(type):
|
||||||
|
|
||||||
def __new__(cls, name, bases, classdict, **args):
|
def __new__(cls, name, bases, classdict, **args):
|
||||||
result = type.__new__(cls, name, bases, classdict)
|
result = type.__new__(cls, name, bases, classdict)
|
||||||
if bases and bases[0] is not StructRNA:
|
if bases and bases[0] is not StructRNA:
|
||||||
@ -562,6 +563,7 @@ class RNAMeta(type):
|
|||||||
|
|
||||||
|
|
||||||
class OrderedDictMini(dict):
|
class OrderedDictMini(dict):
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
self.order = []
|
self.order = []
|
||||||
dict.__init__(self, args)
|
dict.__init__(self, args)
|
||||||
@ -581,6 +583,7 @@ class RNAMetaPropGroup(StructMetaPropGroup, RNAMeta):
|
|||||||
|
|
||||||
|
|
||||||
class OrderedMeta(RNAMeta):
|
class OrderedMeta(RNAMeta):
|
||||||
|
|
||||||
def __init__(cls, name, bases, attributes):
|
def __init__(cls, name, bases, attributes):
|
||||||
if attributes.__class__ is OrderedDictMini:
|
if attributes.__class__ is OrderedDictMini:
|
||||||
cls.order = attributes.order
|
cls.order = attributes.order
|
||||||
|
@ -121,8 +121,8 @@ def expand(line, cursor, namespace, private=True):
|
|||||||
"""
|
"""
|
||||||
if line[:cursor].strip().endswith('('):
|
if line[:cursor].strip().endswith('('):
|
||||||
from . import complete_calltip
|
from . import complete_calltip
|
||||||
matches, word, scrollback = complete_calltip.complete(line,
|
matches, word, scrollback = complete_calltip.complete(
|
||||||
cursor, namespace)
|
line, cursor, namespace)
|
||||||
prefix = os.path.commonprefix(matches)[len(word):]
|
prefix = os.path.commonprefix(matches)[len(word):]
|
||||||
no_calltip = False
|
no_calltip = False
|
||||||
else:
|
else:
|
||||||
|
@ -92,7 +92,8 @@ class ProgressReport:
|
|||||||
self.wm.progress_update(steps)
|
self.wm.progress_update(steps)
|
||||||
if msg:
|
if msg:
|
||||||
prefix = " " * (len(self.steps) - 1)
|
prefix = " " * (len(self.steps) - 1)
|
||||||
print(prefix + "(%8.4f sec | %8.4f sec) %s\nProgress: %6.2f%%\r" % (tm, loc_tm, msg, steps_percent), end='')
|
print(prefix + "(%8.4f sec | %8.4f sec) %s\nProgress: %6.2f%%\r" %
|
||||||
|
(tm, loc_tm, msg, steps_percent), end='')
|
||||||
else:
|
else:
|
||||||
print("Progress: %6.2f%%\r" % (steps_percent,), end='')
|
print("Progress: %6.2f%%\r" % (steps_percent,), end='')
|
||||||
|
|
||||||
|
@ -119,8 +119,10 @@ class InfoStructRNA:
|
|||||||
def build(self):
|
def build(self):
|
||||||
rna_type = self.bl_rna
|
rna_type = self.bl_rna
|
||||||
parent_id = self.identifier
|
parent_id = self.identifier
|
||||||
self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id) for rna_prop in get_direct_properties(rna_type) if rna_prop.identifier != "rna_type"]
|
self.properties[:] = [GetInfoPropertyRNA(rna_prop, parent_id)
|
||||||
self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id) for rna_prop in get_direct_functions(rna_type)]
|
for rna_prop in get_direct_properties(rna_type) if rna_prop.identifier != "rna_type"]
|
||||||
|
self.functions[:] = [GetInfoFunctionRNA(rna_prop, parent_id)
|
||||||
|
for rna_prop in get_direct_functions(rna_type)]
|
||||||
|
|
||||||
def get_bases(self):
|
def get_bases(self):
|
||||||
bases = []
|
bases = []
|
||||||
@ -600,7 +602,8 @@ def BuildRNAInfo():
|
|||||||
for rna_prop_ptr in (getattr(rna_prop, "fixed_type", None), getattr(rna_prop, "srna", None)):
|
for rna_prop_ptr in (getattr(rna_prop, "fixed_type", None), getattr(rna_prop, "srna", None)):
|
||||||
# Does this property point to me?
|
# Does this property point to me?
|
||||||
if rna_prop_ptr:
|
if rna_prop_ptr:
|
||||||
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_prop_identifier))
|
rna_references_dict[rna_prop_ptr.identifier].append(
|
||||||
|
"%s.%s" % (rna_struct_path, rna_prop_identifier))
|
||||||
|
|
||||||
for rna_func in get_direct_functions(rna_struct):
|
for rna_func in get_direct_functions(rna_struct):
|
||||||
for rna_prop_identifier, rna_prop in rna_func.parameters.items():
|
for rna_prop_identifier, rna_prop in rna_func.parameters.items():
|
||||||
@ -612,7 +615,8 @@ def BuildRNAInfo():
|
|||||||
|
|
||||||
# Does this property point to me?
|
# Does this property point to me?
|
||||||
if rna_prop_ptr:
|
if rna_prop_ptr:
|
||||||
rna_references_dict[rna_prop_ptr.identifier].append("%s.%s" % (rna_struct_path, rna_func.identifier))
|
rna_references_dict[rna_prop_ptr.identifier].append(
|
||||||
|
"%s.%s" % (rna_struct_path, rna_func.identifier))
|
||||||
|
|
||||||
# Store nested children
|
# Store nested children
|
||||||
nested = rna_struct.nested
|
nested = rna_struct.nested
|
||||||
@ -664,7 +668,8 @@ def BuildRNAInfo():
|
|||||||
default = prop.default
|
default = prop.default
|
||||||
if type(default) in {float, int}:
|
if type(default) in {float, int}:
|
||||||
if default < prop.min or default > prop.max:
|
if default < prop.min or default > prop.max:
|
||||||
print("\t %s.%s, %s not in [%s - %s]" % (rna_info.identifier, prop.identifier, default, prop.min, prop.max))
|
print("\t %s.%s, %s not in [%s - %s]" %
|
||||||
|
(rna_info.identifier, prop.identifier, default, prop.min, prop.max))
|
||||||
|
|
||||||
# now for operators
|
# now for operators
|
||||||
op_mods = dir(bpy.ops)
|
op_mods = dir(bpy.ops)
|
||||||
@ -701,7 +706,7 @@ def main():
|
|||||||
struct = rna_info.BuildRNAInfo()[0]
|
struct = rna_info.BuildRNAInfo()[0]
|
||||||
data = []
|
data = []
|
||||||
for struct_id, v in sorted(struct.items()):
|
for struct_id, v in sorted(struct.items()):
|
||||||
struct_id_str = v.identifier #~ "".join(sid for sid in struct_id if struct_id)
|
struct_id_str = v.identifier # "".join(sid for sid in struct_id if struct_id)
|
||||||
|
|
||||||
for base in v.get_bases():
|
for base in v.get_bases():
|
||||||
struct_id_str = base.identifier + "|" + struct_id_str
|
struct_id_str = base.identifier + "|" + struct_id_str
|
||||||
@ -714,7 +719,10 @@ def main():
|
|||||||
if prop.array_length > 0:
|
if prop.array_length > 0:
|
||||||
prop_type += "[%d]" % prop.array_length
|
prop_type += "[%d]" % prop.array_length
|
||||||
|
|
||||||
data.append("%s.%s -> %s: %s%s %s" % (struct_id_str, prop.identifier, prop.identifier, prop_type, ", (read-only)" if prop.is_readonly else "", prop.description))
|
data.append(
|
||||||
|
"%s.%s -> %s: %s%s %s" %
|
||||||
|
(struct_id_str, prop.identifier, prop.identifier, prop_type,
|
||||||
|
", (read-only)" if prop.is_readonly else "", prop.description))
|
||||||
data.sort()
|
data.sort()
|
||||||
|
|
||||||
if bpy.app.background:
|
if bpy.app.background:
|
||||||
|
@ -276,7 +276,8 @@ def xml2rna(root_xml,
|
|||||||
if value_xml.startswith("#"):
|
if value_xml.startswith("#"):
|
||||||
# read hexidecimal value as float array
|
# read hexidecimal value as float array
|
||||||
value_xml_split = value_xml[1:]
|
value_xml_split = value_xml[1:]
|
||||||
value_xml_coerce = [int(value_xml_split[i:i + 2], 16) / 255 for i in range(0, len(value_xml_split), 2)]
|
value_xml_coerce = [int(value_xml_split[i:i + 2], 16) /
|
||||||
|
255 for i in range(0, len(value_xml_split), 2)]
|
||||||
del value_xml_split
|
del value_xml_split
|
||||||
else:
|
else:
|
||||||
value_xml_split = value_xml.split()
|
value_xml_split = value_xml.split()
|
||||||
|
@ -53,7 +53,8 @@ def write_sysinfo(filepath):
|
|||||||
|
|
||||||
# build info
|
# build info
|
||||||
output.write(title("Blender"))
|
output.write(title("Blender"))
|
||||||
output.write("version: %s, branch: %s, commit date: %s %s, hash: %s, type: %s\n" %
|
output.write(
|
||||||
|
"version: %s, branch: %s, commit date: %s %s, hash: %s, type: %s\n" %
|
||||||
(bpy.app.version_string,
|
(bpy.app.version_string,
|
||||||
prepr(bpy.app.build_branch),
|
prepr(bpy.app.build_branch),
|
||||||
prepr(bpy.app.build_commit_date),
|
prepr(bpy.app.build_commit_date),
|
||||||
@ -105,7 +106,8 @@ def write_sysinfo(filepath):
|
|||||||
ffmpeg = bpy.app.ffmpeg
|
ffmpeg = bpy.app.ffmpeg
|
||||||
if ffmpeg.supported:
|
if ffmpeg.supported:
|
||||||
for lib in ("avcodec", "avdevice", "avformat", "avutil", "swscale"):
|
for lib in ("avcodec", "avdevice", "avformat", "avutil", "swscale"):
|
||||||
output.write("%s:%s%r\n" % (lib, " " * (10 - len(lib)),
|
output.write(
|
||||||
|
"%s:%s%r\n" % (lib, " " * (10 - len(lib)),
|
||||||
getattr(ffmpeg, lib + "_version_string")))
|
getattr(ffmpeg, lib + "_version_string")))
|
||||||
else:
|
else:
|
||||||
output.write("Blender was built without FFmpeg support\n")
|
output.write("Blender was built without FFmpeg support\n")
|
||||||
@ -205,4 +207,3 @@ def write_sysinfo(filepath):
|
|||||||
output.write(cycles.engine.system_info())
|
output.write(cycles.engine.system_info())
|
||||||
|
|
||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user