pep8 cleanup
This commit is contained in:
@@ -48,7 +48,7 @@ def _main():
|
||||
pydoc.getpager = lambda: pydoc.plainpager
|
||||
pydoc.Helper.getline = lambda self, prompt: None
|
||||
pydoc.TextDoc.use_bold = lambda self, text: text
|
||||
|
||||
|
||||
# Possibly temp. addons path
|
||||
from os.path import join, dirname, normpath
|
||||
_sys.path.append(normpath(join(dirname(__file__), "..", "..", "addons", "modules")))
|
||||
|
||||
@@ -137,13 +137,12 @@ class bpy_ops_submodule_op(object):
|
||||
@staticmethod
|
||||
def _scene_update(context):
|
||||
scene = context.scene
|
||||
if scene: # None in backgroud mode
|
||||
if scene: # None in backgroud mode
|
||||
scene.update()
|
||||
else:
|
||||
import bpy
|
||||
for scene in bpy.data.scenes:
|
||||
scene.update()
|
||||
|
||||
|
||||
__doc__ = property(_get_doc)
|
||||
|
||||
@@ -196,7 +195,8 @@ class bpy_ops_submodule_op(object):
|
||||
as_string = op_as_string(idname)
|
||||
op_class = getattr(bpy.types, idname)
|
||||
descr = op_class.bl_rna.description
|
||||
# XXX, workaround for not registering every __doc__ to save time on load.
|
||||
# XXX, workaround for not registering
|
||||
# every __doc__ to save time on load.
|
||||
if not descr:
|
||||
descr = op_class.__doc__
|
||||
if not descr:
|
||||
|
||||
@@ -204,7 +204,7 @@ def module_names(path, recursive=False):
|
||||
|
||||
for filename in sorted(_os.listdir(path)):
|
||||
if filename == "modules":
|
||||
pass # XXX, hard coded exception.
|
||||
pass # XXX, hard coded exception.
|
||||
elif filename.endswith(".py") and filename != "__init__.py":
|
||||
fullpath = join(path, filename)
|
||||
modules.append((filename[0:-3], fullpath))
|
||||
|
||||
@@ -31,6 +31,7 @@ import bpy as _bpy
|
||||
import os as _os
|
||||
import sys as _sys
|
||||
|
||||
|
||||
def _test_import(module_name, loaded_modules):
|
||||
import traceback
|
||||
import time
|
||||
@@ -203,13 +204,11 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
|
||||
# deal with addons seperately
|
||||
addon_reset_all(reload_scripts)
|
||||
|
||||
|
||||
# run the active integration preset
|
||||
filepath = preset_find(_bpy.context.user_preferences.inputs.active_keyconfig, "keyconfig")
|
||||
if filepath:
|
||||
keyconfig_set(filepath)
|
||||
|
||||
|
||||
if reload_scripts:
|
||||
import gc
|
||||
print("gc.collect() -> %d" % gc.collect())
|
||||
@@ -368,7 +367,6 @@ def addon_enable(module_name, default_set=True):
|
||||
import bpy_types as _bpy_types
|
||||
import imp
|
||||
|
||||
|
||||
_bpy_types._register_immediate = False
|
||||
|
||||
def handle_error():
|
||||
@@ -376,7 +374,6 @@ def addon_enable(module_name, default_set=True):
|
||||
traceback.print_exc()
|
||||
_bpy_types._register_immediate = True
|
||||
|
||||
|
||||
# reload if the mtime changes
|
||||
mod = sys.modules.get(module_name)
|
||||
if mod:
|
||||
@@ -428,7 +425,7 @@ def addon_enable(module_name, default_set=True):
|
||||
if not ext:
|
||||
ext = _bpy.context.user_preferences.addons.new()
|
||||
ext.module = module_name
|
||||
|
||||
|
||||
_bpy_types._register_immediate = True
|
||||
|
||||
mod.__addon_enabled__ = True
|
||||
@@ -471,7 +468,7 @@ def addon_disable(module_name, default_set=True):
|
||||
addon = addons.get(module_name)
|
||||
if addon:
|
||||
addons.remove(addon)
|
||||
|
||||
|
||||
print("\tbpy.utils.addon_disable", module_name)
|
||||
|
||||
|
||||
@@ -483,10 +480,10 @@ def addon_reset_all(reload_scripts=False):
|
||||
|
||||
# RELEASE SCRIPTS: official scripts distributed in Blender releases
|
||||
paths = script_paths("addons")
|
||||
|
||||
|
||||
# CONTRIB SCRIPTS: good for testing but not official scripts yet
|
||||
paths += script_paths("addons_contrib")
|
||||
|
||||
|
||||
# EXTERN SCRIPTS: external projects scripts
|
||||
paths += script_paths("addons_extern")
|
||||
|
||||
@@ -513,9 +510,9 @@ def addon_reset_all(reload_scripts=False):
|
||||
def preset_find(name, preset_path, display_name=False):
|
||||
if not name:
|
||||
return None
|
||||
|
||||
|
||||
for directory in preset_paths(preset_path):
|
||||
|
||||
|
||||
if display_name:
|
||||
filename = ""
|
||||
for fn in _os.listdir(directory):
|
||||
@@ -558,7 +555,7 @@ def keyconfig_set(filepath):
|
||||
keyconfigs.remove(kc_dupe)
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
kc_new.name = name
|
||||
keyconfigs.active = kc_new
|
||||
|
||||
@@ -595,4 +592,3 @@ def user_resource(type, path="", create=False):
|
||||
target_path = ""
|
||||
|
||||
return target_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user