pep8 cleanup

This commit is contained in:
Campbell Barton
2013-06-27 03:05:19 +00:00
parent bb42703ea3
commit 2085a42e52
22 changed files with 148 additions and 120 deletions

View File

@@ -35,6 +35,7 @@ FLAG_MESSAGES = {
FORBIDDEN: "Explicitly forbidden!",
}
def gen_menu_file(stats, settings):
# Generate languages file used by Blender's i18n system.
# First, match all entries in LANGUAGES to a lang in stats, if possible!

View File

@@ -507,7 +507,8 @@ def keyconfig_set(filepath, report=None):
report({'ERROR'}, error_msg)
print(error_msg)
kc_new = next(chain(iter(kc for kc in keyconfigs if kc not in keyconfigs_old), (None,)))
kc_new = next(chain(iter(kc for kc in keyconfigs
if kc not in keyconfigs_old), (None,)))
if kc_new is None:
if report is not None:
report({'ERROR'}, "Failed to load keymap %r" % filepath)

View File

@@ -110,7 +110,7 @@ def complete_indices(word, namespace, obj=None, base=None):
# dictionary type
matches = ['%s[%r]' % (base, key) for key in sorted(obj.keys())]
else:
# list type,
# list type
matches = ['%s[%d]' % (base, idx) for idx in range(obj_len)]
if word != base:
matches = [match for match in matches if match.startswith(word)]

View File

@@ -42,6 +42,7 @@ class NodeCategory():
yield item
self.items = items_gen
class NodeItem():
def __init__(self, nodetype, label=None, settings={}, poll=None):
self.nodetype = nodetype
@@ -81,6 +82,7 @@ class NodeItemCustom():
_node_categories = {}
def register_node_categories(identifier, cat_list):
if identifier in _node_categories:
raise KeyError("Node categories list '%s' already registered" % identifier)
@@ -97,21 +99,21 @@ def register_node_categories(identifier, cat_list):
menu_types = []
panel_types = []
for cat in cat_list:
menu_type = type("NODE_MT_category_"+cat.identifier, (bpy.types.Menu,), {
"bl_space_type" : 'NODE_EDITOR',
"bl_label" : cat.name,
"category" : cat,
"poll" : cat.poll,
"draw" : draw_node_item,
menu_type = type("NODE_MT_category_" + cat.identifier, (bpy.types.Menu,), {
"bl_space_type": 'NODE_EDITOR',
"bl_label": cat.name,
"category": cat,
"poll": cat.poll,
"draw": draw_node_item,
})
panel_type = type("NODE_PT_category_"+cat.identifier, (bpy.types.Panel,), {
"bl_space_type" : 'NODE_EDITOR',
"bl_region_type" : 'TOOLS',
"bl_label" : cat.name,
"bl_options" : {'DEFAULT_CLOSED'},
"category" : cat,
"poll" : cat.poll,
"draw" : draw_node_item,
panel_type = type("NODE_PT_category_" + cat.identifier, (bpy.types.Panel,), {
"bl_space_type": 'NODE_EDITOR',
"bl_region_type": 'TOOLS',
"bl_label": cat.name,
"bl_options": {'DEFAULT_CLOSED'},
"category": cat,
"poll": cat.poll,
"draw": draw_node_item,
})
menu_types.append(menu_type)
@@ -166,4 +168,3 @@ def unregister_node_categories(identifier=None):
for cat_types in _node_categories.values():
unregister_node_cat_types(cat_types)
_node_categories.clear()