pep8 cleanup and remove unused vars/imports

This commit is contained in:
Campbell Barton 2011-02-17 04:35:41 +00:00
parent f7295ad6d9
commit 812f238494
20 changed files with 61 additions and 97 deletions

View File

@ -34,7 +34,7 @@ IGNORE = \
"/ik_glut_test/"
import os
from os.path import join, dirname, normpath, abspath
from os.path import join, dirname, normpath, abspath, splitext
base = join(os.path.dirname(__file__), "..", "..")
base = normpath(base)
@ -45,9 +45,6 @@ print("Scanning:", base)
global_h = set()
global_c = set()
import os
from os.path import splitext
def source_list(path, filename_check=None):
for dirpath, dirnames, filenames in os.walk(path):

View File

@ -45,11 +45,6 @@ def source_list(path, filename_check=None):
# extension checking
def is_c_header(filename):
ext = splitext(filename)[1]
return (ext in (".h", ".hpp", ".hxx"))
def is_cmake(filename):
ext = splitext(filename)[1]
return (ext == ".cmake") or (filename == "CMakeLists.txt")

View File

@ -28,7 +28,6 @@
# <pep8 compliant>
import sys
import os
if len(sys.argv) < 2:
sys.stdout.write("Usage: ctodata <c_file>\n")

View File

@ -74,9 +74,6 @@ def modules_from_path(path, loaded_modules):
:return: all loaded modules.
:rtype: list
"""
import traceback
import time
modules = []
for mod_name, mod_path in _bpy.path.module_names(path):

View File

@ -50,8 +50,6 @@ def textWrap(text, length=70):
def write_sysinfo(op):
output_filename = "system-info.txt"
warnings = 0
notices = 0
if output_filename in bpy.data.texts.keys():
output = bpy.data.texts[output_filename]

View File

@ -476,7 +476,6 @@ class MakeDupliFace(bpy.types.Operator):
def _main(self, context):
from mathutils import Vector
from math import sqrt
SCALE_FAC = 0.01
offset = 0.5 * SCALE_FAC

View File

@ -157,42 +157,42 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
bl_label = "Pose Library"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
def draw(self, context):
layout = self.layout
ob = context.object
poselib = ob.pose_library
row = layout.row()
row.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
if poselib:
activePoseIndex = poselib.pose_markers.active_index
if poselib.pose_markers.active:
activePoseName = poselib.pose_markers.active.name
else:
activePoseName = ""
row = layout.row()
row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
col = row.column(align=True)
col.active = (poselib.library is None)
# invoke should still be used for 'add', as it is needed to allow
# invoke should still be used for 'add', as it is needed to allow
# add/replace options to be used properly
col.operator("poselib.pose_add", icon='ZOOMIN', text="")
col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = activePoseName
col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = activePoseIndex
row = layout.row()
row.operator("poselib.action_sanitise")

View File

@ -283,7 +283,6 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
@classmethod
def poll(cls, context):
ob = context.active_object
rd = context.scene.render
return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH'

View File

@ -126,7 +126,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
elif mat:
split.template_ID(space, "pin_id")
split.separator()
if mat:
layout.prop(mat, "type", expand=True)
if mat.use_nodes:
@ -150,46 +150,46 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Render Pipeline Options"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return mat and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self. layout
mat = context.material
#split = layout.split()
mat_type = mat.type in ('SURFACE', 'WIRE')
mat_type = mat.type in ('SURFACE', 'WIRE')
row = layout.row()
row.active = mat_type
row.prop(mat, "use_transparency")
sub = row.column()
sub.prop(mat, "offset_z")
sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
row = layout.row()
row.active = mat.use_transparency or not mat_type
row.prop(mat, "transparency_method", expand=True)
layout.separator()
layout.separator()
split = layout.split()
col = split.column()
col.prop(mat, "use_raytrace") #
col.prop(mat, "use_full_oversampling") #
col.prop(mat, "use_raytrace")
col.prop(mat, "use_full_oversampling")
sub = col.column()
sub.active = mat_type
sub.prop(mat, "use_sky")
sub.prop(mat, "invert_z")
col = split.column()
col.active = mat_type
col.prop(mat, "use_cast_shadows_only", text="Cast Only")
col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
col.prop(mat, "use_cast_buffer_shadows")
@ -205,7 +205,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -264,7 +264,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -321,7 +321,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -359,17 +359,17 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
base_mat = context.material
mat = active_node_mat(context.material)
rayt = mat.raytrace_transparency
split = layout.split()
col = split.column()
col.prop(mat, "alpha")
row = col.row()
row.active = base_mat.use_transparency and (not mat.use_shadeless) #
row.active = base_mat.use_transparency and (not mat.use_shadeless)
row.prop(mat, "specular_alpha", text="Specular")
col = split.column()
@ -413,7 +413,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
def draw_header(self, context):
raym = active_node_mat(context.material).raytrace_mirror
self.layout.prop(raym, "use", text="")
def draw(self, context):
@ -679,7 +679,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -717,7 +717,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@ -874,13 +874,13 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
bl_label = "Options"
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
mat = context.material
engine = context.scene.render.engine
return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout

View File

@ -329,8 +329,6 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): #
return (context.object)
def draw(self, context):
layout = self.layout
ob = context.object
self.draw_settings(context, ob.animation_visualisation)

View File

@ -40,17 +40,18 @@ def particle_panel_poll(cls, context):
psys = context.particle_system
engine = context.scene.render.engine
settings = 0
if psys:
settings = psys.settings
elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
settings = context.space_data.pin_id
if not settings:
return False
return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
def particle_get_settings(context):
if context.particle_system:
return context.particle_system.settings
@ -97,18 +98,18 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
if psys == None:
part = particle_get_settings(context)
if part == None:
return
layout.template_ID(context.space_data, "pin_id")
if part.is_fluid:
layout.label(text="Settings used for fluid.")
return
layout.prop(part, "type", text="Type")
elif not psys.settings:
split = layout.split(percentage=0.32)
@ -392,7 +393,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
if particle_panel_poll(PARTICLE_PT_rotation, context):
psys = context.particle_system
settings = particle_get_settings(context)
if settings.type == 'HAIR' and not settings.use_advanced_hair:
return False
return settings.physics_type != 'BOIDS' and (psys == None or not psys.point_cache.use_external)

View File

@ -304,18 +304,17 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
if file_format == 'PNG':
layout.prop(rd, "file_quality", slider=True, text="Compression")
if file_format in ('OPEN_EXR', 'MULTILAYER'):
row = layout.row()
row.prop(rd, "exr_codec", text="Codec")
if file_format == 'OPEN_EXR':
row = layout.row()
row.prop(rd, "use_exr_half")
row.prop(rd, "exr_zbuf")
row.prop(rd, "exr_preview")
elif file_format == 'JPEG2000':
split = layout.split()
col = split.column()
@ -418,7 +417,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Mux:")
col.prop(rd, "ffmpeg_muxrate", text="Rate")
col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
layout.separator()
# Audio:

View File

@ -25,7 +25,7 @@ class CONSOLE_HT_header(bpy.types.Header):
bl_space_type = 'CONSOLE'
def draw(self, context):
sc = context.space_data
# sc = context.space_data
# text = sc.text
layout = self.layout

View File

@ -26,9 +26,7 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
wm = context.window_manager
window = context.window
sinfo = context.space_data
scene = context.scene
rd = scene.render
@ -70,6 +68,7 @@ class INFO_HT_header(bpy.types.Header):
# XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
"""
sinfo = context.space_data
row = layout.row(align=True)
row.prop(sinfo, "show_report_debug", text="Debug")
row.prop(sinfo, "show_report_info", text="Info")

View File

@ -66,8 +66,6 @@ class LOGIC_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
st = context.space_data
row = layout.row(align=True)
row.template_header()

View File

@ -353,7 +353,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
render = context.scene.render
frame_current = scene.frame_current
strip = act_strip(context)

View File

@ -817,7 +817,6 @@ class USERPREF_PT_input(InputKeyMapPanel):
#start = time.time()
userpref = context.user_preferences
wm = context.window_manager
inputs = userpref.inputs
@ -871,9 +870,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
import sys
import time
modules = []
loaded_modules = set()
# RELEASE SCRIPTS: official scripts distributed in Blender releases
paths = bpy.utils.script_paths("addons")
@ -885,9 +881,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
# 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:

View File

@ -676,7 +676,6 @@ class WM_OT_keymap_edit(bpy.types.Operator):
bl_label = "Edit Key Map"
def execute(self, context):
wm = context.window_manager
km = context.keymap
km.copy_to_user()
return {'FINISHED'}
@ -715,7 +714,6 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
return km.is_user_defined
def execute(self, context):
wm = context.window_manager
km = context.keymap
kmi = km.items.from_id(self.item_id)
@ -779,7 +777,6 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
return wm.keyconfigs.active.is_user_defined
def execute(self, context):
import sys
wm = context.window_manager
keyconfig = wm.keyconfigs.active
wm.keyconfigs.remove(keyconfig)

View File

@ -647,10 +647,11 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
bl_label = "Select"
def draw(self, context):
layout = self.layout
# layout = self.layout
# TODO
# see view3d_select_faceselmenu
pass
# ********** Object menu **********
@ -1151,8 +1152,6 @@ class VIEW3D_MT_pose(bpy.types.Menu):
def draw(self, context):
layout = self.layout
arm = context.active_object.data
layout.operator("ed.undo")
layout.operator("ed.redo")
@ -1447,7 +1446,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
totvert = mesh.total_vert_sel
# totvert = mesh.total_vert_sel
if select_mode[2] and totface == 1:
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
@ -1475,7 +1474,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
totvert = mesh.total_vert_sel
# totvert = mesh.total_vert_sel
if totface >= 1:
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
@ -1958,7 +1957,6 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
layout = self.layout
view = context.space_data
scene = context.scene
col = layout.column()
col.active = view.region_3d.view_perspective != 'CAMERA'

View File

@ -782,8 +782,9 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
settings = __class__.paint_settings(context)
brush = settings.brush
texture_paint = context.texture_paint_object
sculpt = context.sculpt_object
## Unused
# texture_paint = context.texture_paint_object
# sculpt = context.sculpt_object
col = layout.column(align=True)
@ -941,7 +942,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
tool_settings = context.tool_settings
sculpt = tool_settings.sculpt
settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@ -978,7 +978,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
sculpt = context.tool_settings.sculpt
settings = __class__.paint_settings(context)
brush = settings.brush
split = layout.split()
@ -1011,7 +1010,6 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
sculpt = context.tool_settings.sculpt
settings = __class__.paint_settings(context)
brush = settings.brush