Cleanup: Python code-style
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
from bpy.types import (
|
||||
Header,
|
||||
Menu,
|
||||
Panel,
|
||||
)
|
||||
from bpy.app.translations import pgettext_iface as iface_
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
|
||||
@@ -270,9 +274,9 @@ class USERPREF_PT_interface(Panel):
|
||||
col.prop(view, "view2d_grid_spacing_min", text="Minimum Grid Spacing")
|
||||
col.prop(view, "timecode_style")
|
||||
col.prop(view, "view_frame_type")
|
||||
if (view.view_frame_type == 'SECONDS'):
|
||||
if view.view_frame_type == 'SECONDS':
|
||||
col.prop(view, "view_frame_seconds")
|
||||
elif (view.view_frame_type == 'KEYFRAMES'):
|
||||
elif view.view_frame_type == 'KEYFRAMES':
|
||||
col.prop(view, "view_frame_keyframes")
|
||||
|
||||
row.separator()
|
||||
@@ -619,7 +623,7 @@ class USERPREF_MT_interface_theme_presets(Menu):
|
||||
preset_xml_map = (
|
||||
("user_preferences.themes[0]", "Theme"),
|
||||
("user_preferences.ui_styles[0]", "ThemeStyle"),
|
||||
)
|
||||
)
|
||||
draw = Menu.draw_preset
|
||||
|
||||
|
||||
@@ -639,20 +643,20 @@ class USERPREF_PT_theme(Panel):
|
||||
"split_normal",
|
||||
"bone_solid",
|
||||
"paint_curve_pivot",
|
||||
},
|
||||
},
|
||||
'GRAPH_EDITOR': {
|
||||
"handle_vertex_select",
|
||||
},
|
||||
},
|
||||
'IMAGE_EDITOR': {
|
||||
"paint_curve_pivot",
|
||||
},
|
||||
},
|
||||
'NODE_EDITOR': {
|
||||
"layout_node",
|
||||
},
|
||||
},
|
||||
'CLIP_EDITOR': {
|
||||
"handle_vertex_select",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _theme_generic(split, themedata, theme_area):
|
||||
@@ -938,8 +942,8 @@ class USERPREF_PT_theme(Panel):
|
||||
elif theme.theme_area == 'BONE_COLOR_SETS':
|
||||
col = split.column()
|
||||
|
||||
for i, ui in enumerate(theme.bone_color_sets):
|
||||
col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0
|
||||
for i, ui in enumerate(theme.bone_color_sets, 1):
|
||||
col.label(text=iface_("Color Set %d:") % 1, translate=False)
|
||||
|
||||
row = col.row()
|
||||
|
||||
@@ -1301,22 +1305,23 @@ class USERPREF_MT_addons_online_resources(Menu):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator(
|
||||
"wm.url_open", text="Add-ons Catalog", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts"
|
||||
"wm.url_open", text="Add-ons Catalog", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts"
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator(
|
||||
"wm.url_open", text="How to share your add-on", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
|
||||
"wm.url_open", text="How to share your add-on", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
|
||||
layout.operator(
|
||||
"wm.url_open", text="Add-on Guidelines", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
|
||||
"wm.url_open", text="Add-on Guidelines", icon='URL',
|
||||
).url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
|
||||
layout.operator(
|
||||
"wm.url_open", text="API Concepts", icon='URL',
|
||||
).url = bpy.types.WM_OT_doc_view._prefix + "/info_quickstart.html"
|
||||
layout.operator("wm.url_open", text="Add-on Tutorial", icon='URL',
|
||||
).url = bpy.types.WM_OT_doc_view._prefix + "/info_tutorial_addon.html"
|
||||
"wm.url_open", text="API Concepts", icon='URL',
|
||||
).url = bpy.types.WM_OT_doc_view._prefix + "/info_quickstart.html"
|
||||
layout.operator(
|
||||
"wm.url_open", text="Add-on Tutorial", icon='URL',
|
||||
).url = bpy.types.WM_OT_doc_view._prefix + "/info_tutorial_addon.html"
|
||||
|
||||
|
||||
class USERPREF_PT_addons(Panel):
|
||||
@@ -1341,8 +1346,10 @@ class USERPREF_PT_addons(Panel):
|
||||
import os
|
||||
|
||||
if not user_addon_paths:
|
||||
for path in (bpy.utils.script_path_user(),
|
||||
bpy.utils.script_path_pref()):
|
||||
for path in (
|
||||
bpy.utils.script_path_user(),
|
||||
bpy.utils.script_path_pref(),
|
||||
):
|
||||
if path is not None:
|
||||
user_addon_paths.append(os.path.join(path, "addons"))
|
||||
|
||||
@@ -1374,7 +1381,10 @@ class USERPREF_PT_addons(Panel):
|
||||
scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons")
|
||||
|
||||
# collect the categories that can be filtered on
|
||||
addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(refresh=False)]
|
||||
addons = [
|
||||
(mod, addon_utils.module_bl_info(mod))
|
||||
for mod in addon_utils.modules(refresh=False)
|
||||
]
|
||||
|
||||
split = layout.split(percentage=0.2)
|
||||
col = split.column()
|
||||
@@ -1404,10 +1414,11 @@ class USERPREF_PT_addons(Panel):
|
||||
|
||||
|
||||
if addon_utils.error_encoding:
|
||||
self.draw_error(col,
|
||||
"One or more addons do not have UTF-8 encoding\n"
|
||||
"(see console for details)",
|
||||
)
|
||||
self.draw_error(
|
||||
col,
|
||||
"One or more addons do not have UTF-8 encoding\n"
|
||||
"(see console for details)",
|
||||
)
|
||||
|
||||
filter = context.window_manager.addon_filter
|
||||
search = context.window_manager.addon_search.lower()
|
||||
@@ -1430,8 +1441,7 @@ class USERPREF_PT_addons(Panel):
|
||||
(filter == "Enabled" and is_enabled) or
|
||||
(filter == "Disabled" and not is_enabled) or
|
||||
(filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
|
||||
):
|
||||
|
||||
):
|
||||
if search and search not in info["name"].lower():
|
||||
if info["author"]:
|
||||
if search not in info["author"].lower():
|
||||
@@ -1446,16 +1456,16 @@ class USERPREF_PT_addons(Panel):
|
||||
row = colsub.row(align=True)
|
||||
|
||||
row.operator(
|
||||
"wm.addon_expand",
|
||||
icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT',
|
||||
emboss=False,
|
||||
).module = module_name
|
||||
"wm.addon_expand",
|
||||
icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT',
|
||||
emboss=False,
|
||||
).module = module_name
|
||||
|
||||
row.operator(
|
||||
"wm.addon_disable" if is_enabled else "wm.addon_enable",
|
||||
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="",
|
||||
emboss=False,
|
||||
).module = module_name
|
||||
"wm.addon_disable" if is_enabled else "wm.addon_enable",
|
||||
icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="",
|
||||
emboss=False,
|
||||
).module = module_name
|
||||
|
||||
sub = row.row()
|
||||
sub.active = is_enabled
|
||||
@@ -1500,12 +1510,19 @@ class USERPREF_PT_addons(Panel):
|
||||
split = colsub.row().split(percentage=0.15)
|
||||
split.label(text="Internet:")
|
||||
if info["wiki_url"]:
|
||||
split.operator("wm.url_open", text="Documentation", icon='HELP').url = info["wiki_url"]
|
||||
split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info.get(
|
||||
"tracker_url",
|
||||
"https://developer.blender.org/maniphest/task/edit/form/2")
|
||||
split.operator(
|
||||
"wm.url_open", text="Documentation", icon='HELP',
|
||||
).url = info["wiki_url"]
|
||||
split.operator(
|
||||
"wm.url_open", text="Report a Bug", icon='URL',
|
||||
).url = info.get(
|
||||
"tracker_url",
|
||||
"https://developer.blender.org/maniphest/task/edit/form/2",
|
||||
)
|
||||
if user_addon:
|
||||
split.operator("wm.addon_remove", text="Remove", icon='CANCEL').module = mod.__name__
|
||||
split.operator(
|
||||
"wm.addon_remove", text="Remove", icon='CANCEL',
|
||||
).module = mod.__name__
|
||||
|
||||
for i in range(4 - tot_row):
|
||||
split.separator()
|
||||
@@ -1548,7 +1565,9 @@ class USERPREF_PT_addons(Panel):
|
||||
row.label(text="", icon='ERROR')
|
||||
|
||||
if is_enabled:
|
||||
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
|
||||
row.operator(
|
||||
"wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False,
|
||||
).module = module_name
|
||||
|
||||
row.label(text=module_name, translate=False)
|
||||
|
||||
|
Reference in New Issue
Block a user