code cleanup: pep8 & minor changes

This commit is contained in:
Campbell Barton 2013-03-11 02:19:58 +00:00
parent 81aa46efaa
commit 34f3dc43e7
10 changed files with 29 additions and 32 deletions

@ -111,10 +111,10 @@ def module_list(path):
else: else:
folder_list = [] folder_list = []
#folder_list = glob.glob(os.path.join(path,'*')) #folder_list = glob.glob(os.path.join(path,'*'))
folder_list = [p for p in folder_list \ folder_list = [p for p in folder_list \
if os.path.exists(os.path.join(path, p, '__init__.py'))\ if os.path.exists(os.path.join(path, p, '__init__.py')) \
or p[-3:] in ('.py', '.so')\ or p[-3:] in {'.py', '.so'} \
or p[-4:] in ('.pyc', '.pyo', '.pyd')] or p[-4:] in {'.pyc', '.pyo', '.pyd'}]
folder_list = [os.path.basename(p).split('.')[0] for p in folder_list] folder_list = [os.path.basename(p).split('.')[0] for p in folder_list]
return folder_list return folder_list

@ -1357,4 +1357,3 @@ kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_UP', 'PAGE_UP', 'PRESS', shift
kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'PAGE_DOWN', 'PRESS', shift=True) kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'PAGE_DOWN', 'PRESS', shift=True)
kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_UP', 'WHEELDOWNMOUSE', 'PRESS', shift=True) kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_UP', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'WHEELUPMOUSE', 'PRESS', shift=True) kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'WHEELUPMOUSE', 'PRESS', shift=True)

@ -851,16 +851,16 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, Panel):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
ob = context.object obj = context.object
if ob.type == 'ARMATURE' and ob.mode in ('EDIT', 'POSE'): if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
box = layout.box() box = layout.box()
box.alert = True box.alert = True
box.label(icon='INFO', text="See Bone Constraints tab to Add Constraints to active bone") box.label(icon='INFO', text="See Bone Constraints tab to Add Constraints to active bone")
else: else:
layout.operator_menu_enum("object.constraint_add", "type", text="Add Object Constraint") layout.operator_menu_enum("object.constraint_add", "type", text="Add Object Constraint")
for con in ob.constraints: for con in obj.constraints:
self.draw_constraint(context, con) self.draw_constraint(context, con)

@ -109,7 +109,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
#col = layout.column(align=1) #col = layout.column(align=1)
#col.label(text="Activation:") #col.label(text="Activation:")
# XXX: settings such as activate on collison/etc. # XXX: settings such as activate on collison/etc.
split = layout.split() split = layout.split()

@ -36,7 +36,7 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
if is_nla: if is_nla:
row.prop(dopesheet, "show_missing_nla", text="") row.prop(dopesheet, "show_missing_nla", text="")
else: # graph and dopesheet editors - F-Curves and drivers only else: # graph and dopesheet editors - F-Curves and drivers only
row.prop(dopesheet, "show_only_errors", text="") row.prop(dopesheet, "show_only_errors", text="")
if not genericFiltersOnly: if not genericFiltersOnly:

@ -699,11 +699,11 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
row = col.row(align=True) row = col.row(align=True)
if(brush.use_relative_jitter): if(brush.use_relative_jitter):
row.prop(brush, "use_relative_jitter", text="", icon='LOCKED') row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
row.prop(brush, "jitter", slider=True) row.prop(brush, "jitter", slider=True)
else: else:
row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED') row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
row.prop(brush, "jitter_absolute") row.prop(brush, "jitter_absolute")
row.prop(brush, "use_pressure_jitter", toggle=True, text="") row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend") col.prop(brush, "blend", text="Blend")
@ -726,7 +726,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
col = layout.column() col = layout.column()
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8) col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
brush_texture_settings(col, brush, 0) brush_texture_settings(col, brush, 0)

@ -215,13 +215,13 @@ class InputKeyMapPanel:
_EVENT_TYPES = set() _EVENT_TYPES = set()
_EVENT_TYPE_MAP = {} _EVENT_TYPE_MAP = {}
def draw_filtered(self, display_keymaps, filter_type, filter_text, layout): def draw_filtered(self, display_keymaps, filter_type, filter_text, layout):
if filter_type == 'NAME': if filter_type == 'NAME':
def filter_func(kmi): def filter_func(kmi):
return (filter_text in kmi.idname.lower() or return (filter_text in kmi.idname.lower() or
filter_text in kmi.name.lower()) filter_text in kmi.name.lower())
else: else:
if not self._EVENT_TYPES: if not self._EVENT_TYPES:
enum = bpy.types.Event.bl_rna.properties["type"].enum_items enum = bpy.types.Event.bl_rna.properties["type"].enum_items
@ -272,13 +272,13 @@ class InputKeyMapPanel:
return False return False
elif filter_text_split: elif filter_text_split:
kmi_type = filter_text_split[0].upper() kmi_type = filter_text_split[0].upper()
if kmi_type not in self._EVENT_TYPES: if kmi_type not in self._EVENT_TYPES:
# replacement table # replacement table
kmi_type_test = self._EVENT_TYPE_MAP.get(kmi_type) kmi_type_test = self._EVENT_TYPE_MAP.get(kmi_type)
if kmi_type_test is None: if kmi_type_test is None:
# print("Unknown Type:", kmi_type) # print("Unknown Type:", kmi_type)
# Partial match # Partial match
for k, v in self._EVENT_TYPE_MAP.items(): for k, v in self._EVENT_TYPE_MAP.items():
if kmi_type in k: if kmi_type in k:
@ -293,7 +293,7 @@ class InputKeyMapPanel:
kmi_type = kmi_type_test kmi_type = kmi_type_test
del kmi_type_test del kmi_type_test
kmi_test_dict["type"] = kmi_type kmi_test_dict["type"] = kmi_type
# main filter func, runs many times # main filter func, runs many times

@ -2520,29 +2520,29 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
mesh = context.active_object.data mesh = context.active_object.data
split = layout.split() split = layout.split()
col = split.column() col = split.column()
col.label(text="Overlays:") col.label(text="Overlays:")
col.prop(mesh, "show_faces", text="Faces") col.prop(mesh, "show_faces", text="Faces")
col.prop(mesh, "show_edges", text="Edges") col.prop(mesh, "show_edges", text="Edges")
col.prop(mesh, "show_edge_crease", text="Creases") col.prop(mesh, "show_edge_crease", text="Creases")
col = split.column() col = split.column()
col.label() col.label()
col.prop(mesh, "show_edge_seams", text="Seams") col.prop(mesh, "show_edge_seams", text="Seams")
col.prop(mesh, "show_edge_sharp", text="Sharp") col.prop(mesh, "show_edge_sharp", text="Sharp")
col.prop(mesh, "show_edge_bevel_weight", text="Weights") col.prop(mesh, "show_edge_bevel_weight", text="Weights")
col = layout.column() col = layout.column()
col.separator() col.separator()
col.label(text="Normals:") col.label(text="Normals:")
row = col.row() row = col.row()
sub = row.row(align=True) sub = row.row(align=True)
sub.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL') sub.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
sub.prop(mesh, "show_normal_face", text="", icon='FACESEL') sub.prop(mesh, "show_normal_face", text="", icon='FACESEL')
sub = row.row(align=True) sub = row.row(align=True)
sub.active = mesh.show_normal_vertex or mesh.show_normal_face sub.active = mesh.show_normal_vertex or mesh.show_normal_face
sub.prop(context.scene.tool_settings, "normal_size", text="Size") sub.prop(context.scene.tool_settings, "normal_size", text="Size")

@ -685,7 +685,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED') row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
row.prop(brush, "jitter_absolute") row.prop(brush, "jitter_absolute")
row.prop(brush, "use_pressure_jitter", toggle=True, text="") row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "blend", text="Blend") col.prop(brush, "blend", text="Blend")
col = layout.column() col = layout.column()
@ -712,11 +712,11 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
row = col.row(align=True) row = col.row(align=True)
if(brush.use_relative_jitter): if(brush.use_relative_jitter):
row.prop(brush, "use_relative_jitter", text="", icon='LOCKED') row.prop(brush, "use_relative_jitter", text="", icon='LOCKED')
row.prop(brush, "jitter", slider=True) row.prop(brush, "jitter", slider=True)
else: else:
row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED') row.prop(brush, "use_relative_jitter", text="", icon='UNLOCKED')
row.prop(brush, "jitter_absolute") row.prop(brush, "jitter_absolute")
row.prop(brush, "use_pressure_jitter", toggle=True, text="") row.prop(brush, "use_pressure_jitter", toggle=True, text="")
col.prop(brush, "vertex_tool", text="Blend") col.prop(brush, "vertex_tool", text="Blend")

@ -715,14 +715,12 @@ static void view3d_ruler_header_update(ScrArea *sa)
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/* Operator callbacks */ /* Operator callbacks */
static int view3d_ruler_invoke(bContext *C, wmOperator *op, wmEvent *event) static int view3d_ruler_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{ {
wmWindow *win = CTX_wm_window(C); wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C); ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
// RegionView3D *rv3d = CTX_wm_region_view3d(C);
RulerInfo *ruler_info; RulerInfo *ruler_info;
(void)event;
ruler_info = MEM_callocN(sizeof(RulerInfo), "RulerInfo"); ruler_info = MEM_callocN(sizeof(RulerInfo), "RulerInfo");