pep8 cleanup

This commit is contained in:
2011-01-01 07:20:34 +00:00
parent 2840e7b764
commit 7f3fe8a2df
47 changed files with 288 additions and 303 deletions

View File

@@ -54,7 +54,7 @@ class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
def poll(cls, context):
if context.edit_bone:
return True
ob = context.object
return ob and ob.mode == 'POSE' and context.bone

View File

@@ -62,7 +62,7 @@ class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
if ob:
layout.template_ID(ob, "data")
elif curve:
layout.template_ID(space, "pin_id") # XXX: broken
layout.template_ID(space, "pin_id") # XXX: broken
class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):

View File

@@ -60,13 +60,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
split = layout.split()
col = split.split()
col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
sub = col.column()
sub.active = bool(md.vertex_group)
sub.prop(md, "invert_vertex_group")
col = layout.column()
col.prop(md, "use_multi_modifier")

View File

@@ -68,7 +68,8 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
row.column().prop(ob, "scale")
layout.prop(ob, "rotation_mode")
class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Delta Transform"
bl_options = {'DEFAULT_CLOSED'}

View File

@@ -550,17 +550,16 @@ class ConstraintButtonsPanel():
col.prop(con, "axis_x", text="X")
col.prop(con, "axis_y", text="Y")
col.prop(con, "axis_z", text="Z")
if con.pivot_type == 'CONE_TWIST':
layout.label(text="Limits:")
split = layout.split()
col = split.column(align=True)
col.prop(con, "use_angular_limit_x", text="Angular X")
col.prop(con, "use_angular_limit_y", text="Angular Y")
col.prop(con, "use_angular_limit_z", text="Angular Z")
col = split.column()
col.prop(con, "limit_cone_min", text="")
col = split.column()
@@ -569,7 +568,7 @@ class ConstraintButtonsPanel():
elif con.pivot_type == 'GENERIC_6_DOF':
layout.label(text="Limits:")
split = layout.split()
col = split.column(align=True)
col.prop(con, "use_limit_x", text="X")
col.prop(con, "use_limit_y", text="Y")
@@ -577,12 +576,12 @@ class ConstraintButtonsPanel():
col.prop(con, "use_angular_limit_x", text="Angular X")
col.prop(con, "use_angular_limit_y", text="Angular Y")
col.prop(con, "use_angular_limit_z", text="Angular Z")
col = split.column()
col.prop(con, "limit_generic_min", text="")
col = split.column()
col.prop(con, "limit_generic_max", text="")
def CLAMP_TO(self, context, layout, con):
self.target_template(layout, con)

View File

@@ -337,7 +337,7 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
col.prop(rd, "jpeg2k_ycc")
elif file_format in ('CINEON', 'DPX'):
split = layout.split()
split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
'''
@@ -491,7 +491,7 @@ class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Sampled Motion Blur"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
rd = context.scene.render
@@ -527,7 +527,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
row.operator("render.preset_add", text="", icon="ZOOMIN")
row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
split = layout.split()
col = split.column()

View File

@@ -229,7 +229,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
f.write("# Keying Set: %s\n" % ks.name)
f.write("import bpy\n\n")
f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
# Add KeyingSet and set general settings
f.write("# Keying Set Level declarations\n")
@@ -238,7 +238,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
if not ks.is_path_absolute:
f.write("ks.is_path_absolute = False\n")
f.write("\n")
f.write("ks.bl_options = %r\n" % ks.bl_options)
f.write("\n")

View File

@@ -103,7 +103,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
if tex_collection:
row = layout.row()
row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
col = row.column(align=True)
@@ -143,7 +143,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
split.prop(tex, "type", text="")
class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@@ -394,7 +393,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
idblock = context_tex_datablock(context)
tex = context.texture
slot = context.texture_slot
@@ -410,7 +409,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
col.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
col = split.column()
#Only for Material based textures, not for Lamp/World...
if isinstance(idblock, bpy.types.Material):
col.prop(tex, "use_normal_map")
@@ -900,7 +899,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
sub = row.row()
sub.active = getattr(tex, toggle)
sub.prop(tex, factor, text=name, slider=True)
return sub # XXX, temp. use_map_normal needs to override.
return sub # XXX, temp. use_map_normal needs to override.
if isinstance(idblock, bpy.types.Material):
if idblock.type in ('SURFACE', 'WIRE'):
@@ -939,13 +938,13 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
#sub.prop(tex, "default_value", text="Amount", slider=True)
elif idblock.type == 'HALO':
layout.label(text="Halo:")
split = layout.split()
col = split.column()
factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
col = split.column()
factor_but(col, "use_map_raymir", "raymir_factor", "Size")
factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")

View File

@@ -152,7 +152,7 @@ class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
split = layout.split()
split.prop(light, "indirect_factor", text="Factor")
split.prop(light, "indirect_bounces", text="Bounces")
if light.gather_method == 'RAYTRACE':
layout.label(text="Only works with Approximate gather method")

View File

@@ -20,6 +20,7 @@
import bpy
# used for DopeSheet, NLA, and Graph Editors
def dopesheet_filter(layout, context):
dopesheet = context.space_data.dopesheet
@@ -100,7 +101,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
if st.mode == 'DOPESHEET':
dopesheet_filter(layout, context)
elif st.mode in ('ACTION','SHAPEKEY'):
elif st.mode in ('ACTION', 'SHAPEKEY'):
layout.template_ID(st, "action", new="action.new")
if st.mode != 'GPENCIL':

View File

@@ -57,9 +57,9 @@ class FILEBROWSER_HT_header(bpy.types.Header):
row = layout.row(align=True)
row.active = params.use_filter
row.prop(params, "use_filter_folder", text="")
if params.filter_glob:
#if st.operator and hasattr(st.operator, "filter_glob"):
# row.prop(params, "filter_glob", text="")

View File

@@ -188,7 +188,7 @@ class GRAPH_MT_key(bpy.types.Menu):
layout.separator()
layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
layout.separator()
layout.operator("graph.clean")
layout.operator("graph.sample")

View File

@@ -250,7 +250,8 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.separator()
layout.menu("IMAGE_MT_uvs_showhide")
class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
bl_label = "UV Select Mode"
@@ -259,9 +260,9 @@ class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
toolsettings = context.tool_settings
# do smart things depending on whether uv_select_sync is on
if toolsettings.use_uv_select_sync:
prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
prop.value = "(True, False, False)"
@@ -287,7 +288,7 @@ class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL')
prop.value = "FACE"
prop.data_path = "tool_settings.uv_select_mode"
prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL')
prop.value = "ISLAND"
prop.data_path = "tool_settings.uv_select_mode"

View File

@@ -69,7 +69,6 @@ class INFO_HT_header(bpy.types.Header):
# XXX: this should be right-aligned to the RHS of the region
layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
# XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
"""
row = layout.row(align=True)
@@ -82,7 +81,7 @@ class INFO_HT_header(bpy.types.Header):
row = layout.row()
row.enabled = sinfo.show_report_operator
row.operator("info.report_replay")
row.menu("INFO_MT_report")
"""
@@ -220,6 +219,7 @@ class INFO_MT_curve_add(bpy.types.Menu):
layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
class INFO_MT_edit_curve_add(bpy.types.Menu):
bl_idname = "INFO_MT_edit_curve_add"
bl_label = "Add"
@@ -231,9 +231,9 @@ class INFO_MT_edit_curve_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
if is_surf:
INFO_MT_surface_add.draw(self, context)
INFO_MT_surface_add.draw(self, context)
else:
INFO_MT_curve_add.draw(self, context)
INFO_MT_curve_add.draw(self, context)
class INFO_MT_surface_add(bpy.types.Menu):

View File

@@ -390,7 +390,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
elem = False
if strip.type == 'IMAGE':
elem = strip.getStripElem(frame_current)
elif strip.type == 'MOVIE':
@@ -684,7 +684,7 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
layout.template_ID(strip, "scene_camera")
sce = strip.scene
layout.label(text="Original frame range: "+ str(sce.frame_start) +" - "+ str(sce.frame_end) + " (" + str(sce.frame_end-sce.frame_start+1) + ")")
layout.label(text="Original frame range: %d-%d (%d)" % (sce.frame_start, sce.frame_end, sce.frame_end - sce.frame_start + 1))
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
@@ -793,7 +793,7 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
render = context.scene.render
col = layout.column()
col.active = False #Currently only opengl preview works!
col.active = False # Currently only opengl preview works!
col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
col = layout.column()
#col.active = render.use_sequencer_gl_preview

View File

@@ -73,11 +73,11 @@ class TIME_HT_header(bpy.types.Header):
sub.operator("screen.animation_play", text="", icon='PAUSE')
row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
row.operator("screen.frame_jump", text="", icon='FF').end = True
layout.prop(scene, "sync_mode", text="")
layout.separator()
row = layout.row(align=True)
row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
if screen.is_animation_playing and tools.use_keyframe_insert_auto:

View File

@@ -808,6 +808,7 @@ class USERPREF_PT_input(InputKeyMapPanel):
#print("runtime", time.time() - start)
class USERPREF_MT_addons_dev_guides(bpy.types.Menu):
bl_label = "Addons develoment guides"
@@ -848,21 +849,21 @@ class USERPREF_PT_addons(bpy.types.Panel):
modules = []
loaded_modules = set()
# RELEASE SCRIPTS: official scripts distributed in Blender releases
paths = bpy.utils.script_paths("addons")
# CONTRIB SCRIPTS: good for testing but not official scripts yet
# if folder addons_contrib/ exists, scripts in there will be loaded too
paths += bpy.utils.script_paths("addons_contrib")
# EXTERN SCRIPTS: external projects scripts
# if folder addons_extern/ exists, scripts in there will be loaded too
paths += bpy.utils.script_paths("addons_extern")
if bpy.app.debug:
t_main = time.time()
# fake module importing
def fake_module(mod_name, mod_path, speedy=True):
if bpy.app.debug:
@@ -953,11 +954,11 @@ class USERPREF_PT_addons(bpy.types.Panel):
col = split.column()
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
col.prop(context.window_manager, "addon_filter", text="Filter", expand=True)
# menu to open webpages with addons development guides
col.separator()
col.label(text = ' Online Documentation', icon = 'INFO')
col.menu('USERPREF_MT_addons_dev_guides', text='Addons Developer Guides')
col.label(text=" Online Documentation", icon='INFO')
col.menu("USERPREF_MT_addons_dev_guides", text="Addons Developer Guides")
col = split.column()

View File

@@ -128,6 +128,7 @@ class USERPREF_MT_keyconfigs(bpy.types.Menu):
bl_label = "KeyPresets"
preset_subdir = "keyconfig"
preset_operator = "wm.keyconfig_activate"
def draw(self, context):
props = self.layout.operator("wm.context_set_value", text="Blender (default)")
props.data_path = "window_manager.keyconfigs.active"
@@ -379,7 +380,7 @@ class InputKeyMapPanel(bpy.types.Panel):
subcol = subsplit.column()
row = subcol.row(align=True)
#row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
if not text:
@@ -387,7 +388,7 @@ class InputKeyMapPanel(bpy.types.Panel):
row.menu("USERPREF_MT_keyconfigs", text=text)
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN")
row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True
# layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
# row.operator("wm.keyconfig_remove", text="", icon='X')
@@ -605,7 +606,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
f.write("import bpy\n")
f.write("import os\n\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
f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
# Generate a list of keymaps to export:
#

View File

@@ -647,6 +647,7 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
# ********** Object menu **********
class VIEW3D_MT_object(bpy.types.Menu):
bl_context = "objectmode"
bl_label = "Object"
@@ -1418,7 +1419,7 @@ class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
menu += ["EDGE"]
if mesh.total_vert_sel and select_mode[0]:
menu += ["VERT"]
menu += ["VERT"]
# should never get here
return menu

View File

@@ -1077,9 +1077,9 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
ob = context.active_object
col = layout.column()
col.active = ob.vertex_groups.active != None
col.operator("object.vertex_group_normalize_all", text="Normalize All")