WIP: white space changes to BoltFactory to fix flake8 #105083

Draft
sw-tya wants to merge 3 commits from sw-tya/blender-addons:flake8_bolts into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit e2afa84d7c - Show all commits

View File

@ -26,15 +26,14 @@ class add_mesh_bolt(Operator, AddObjectHelper):
bl_options = {'REGISTER', 'UNDO', 'PRESET'} bl_options = {'REGISTER', 'UNDO', 'PRESET'}
bl_description = "Construct many types of Bolts" bl_description = "Construct many types of Bolts"
MAX_INPUT_NUMBER = 50 MAX_INPUT_NUMBER = 50
Bolt : BoolProperty(name = "Bolt", Bolt: BoolProperty(name="Bolt",
default = True, default=True,
description = "Bolt") description="Bolt")
change : BoolProperty(name = "Change", change: BoolProperty(name="Change",
default = False, default=False,
description = "change Bolt") description="change Bolt")
# Model Types # Model Types
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'), Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
@ -168,7 +167,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
bf_12_Point_Head_Flat_Distance: FloatProperty( bf_12_Point_Head_Flat_Distance: FloatProperty(
attr='bf_12_Point_Head_Flat_Distance', attr='bf_12_Point_Head_Flat_Distance',
name='Flat Dist', default=3.0, name='Flat Dist', default=3.0,
min=0.001, soft_min=0, #limit to 0.001 to avoid calculation error min=0.001, soft_min=0, # limit to 0.001 to avoid calculation error
max=MAX_INPUT_NUMBER, max=MAX_INPUT_NUMBER,
description='Flat Distance of the 12 Point Head', description='Flat Distance of the 12 Point Head',
unit='LENGTH', unit='LENGTH',
@ -327,6 +326,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
description='Flange diameter of the 12 point Nut', description='Flange diameter of the 12 point Nut',
unit='LENGTH', unit='LENGTH',
) )
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
col = layout.column() col = layout.column()
@ -387,8 +387,6 @@ class add_mesh_bolt(Operator, AddObjectHelper):
col.prop(self, 'bf_Hex_Nut_Height') col.prop(self, 'bf_Hex_Nut_Height')
col.prop(self, 'bf_Hex_Nut_Flat_Distance') col.prop(self, 'bf_Hex_Nut_Flat_Distance')
# Thread # Thread
col.label(text='Thread') col.label(text='Thread')
if self.bf_Model_Type == 'bf_Model_Bolt': if self.bf_Model_Type == 'bf_Model_Bolt':
@ -467,6 +465,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
return {'FINISHED'} return {'FINISHED'}
# Register: # Register:
def Bolt_contex_menu(self, context): def Bolt_contex_menu(self, context):
bl_label = 'Change' bl_label = 'Change'
@ -481,18 +480,19 @@ def Bolt_contex_menu(self, context):
setattr(props, prm, obj.data[prm]) setattr(props, prm, obj.data[prm])
layout.separator() layout.separator()
def menu_func_bolt(self, context): def menu_func_bolt(self, context):
layout = self.layout layout = self.layout
layout.separator() layout.separator()
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW") oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
oper.change = False oper.change = False
classes = ( classes = (
add_mesh_bolt, add_mesh_bolt,
) )
def register(): def register():
for cls in classes: for cls in classes:
bpy.utils.register_class(cls) bpy.utils.register_class(cls)
@ -506,6 +506,7 @@ def unregister():
for cls in reversed(classes): for cls in reversed(classes):
bpy.utils.unregister_class(cls) bpy.utils.unregister_class(cls)
def BoltParameters(): def BoltParameters():
BoltParameters = [ BoltParameters = [
"bf_Model_Type", "bf_Model_Type",