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()
|
||||
@@ -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()
|
||||
|
||||
@@ -1315,7 +1319,8 @@ class USERPREF_MT_addons_online_resources(Menu):
|
||||
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',
|
||||
layout.operator(
|
||||
"wm.url_open", text="Add-on Tutorial", icon='URL',
|
||||
).url = bpy.types.WM_OT_doc_view._prefix + "/info_tutorial_addon.html"
|
||||
|
||||
|
||||
@@ -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,7 +1414,8 @@ class USERPREF_PT_addons(Panel):
|
||||
|
||||
|
||||
if addon_utils.error_encoding:
|
||||
self.draw_error(col,
|
||||
self.draw_error(
|
||||
col,
|
||||
"One or more addons do not have UTF-8 encoding\n"
|
||||
"(see console for details)",
|
||||
)
|
||||
@@ -1431,7 +1442,6 @@ class USERPREF_PT_addons(Panel):
|
||||
(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():
|
||||
@@ -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(
|
||||
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")
|
||||
"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