cleanup: py imports
authorCampbell Barton <ideasman42@gmail.com>
Tue, 27 Jan 2015 06:46:07 +0000 (17:46 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 28 Jan 2015 05:50:51 +0000 (16:50 +1100)
26 files changed:
release/scripts/modules/bl_i18n_utils/merge_po.py
release/scripts/modules/bl_i18n_utils/utils.py
release/scripts/modules/bpy/path.py
release/scripts/modules/bpy/utils.py
release/scripts/startup/bl_operators/add_mesh_torus.py
release/scripts/startup/bl_operators/anim.py
release/scripts/startup/bl_operators/console.py
release/scripts/startup/bl_operators/freestyle.py
release/scripts/startup/bl_operators/node.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/object_quick_effects.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/properties_data_camera.py
release/scripts/startup/bl_ui/properties_object.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_physics_cloth.py
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
release/scripts/startup/bl_ui/properties_physics_field.py
release/scripts/startup/bl_ui/properties_physics_smoke.py
release/scripts/startup/bl_ui/properties_physics_softbody.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/properties_texture.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_sequencer.py

index d7dade22ffd5fa55d47a9985880716ac126e5277..2fda42199bb0074736b7d0444d1e571faac47895 100755 (executable)
 
 import sys
 
-try:
+if __package__ is None:
     import settings
     import utils
-except:
-    from . import (settings, utils)
+else:
+    from . import (
+            settings,
+            utils,
+            )
 
 
 # XXX This is a quick hack to make it work with new I18n... objects! To be reworked!
 def main():
     import argparse
-    parser = argparse.ArgumentParser(description=""
+    parser = argparse.ArgumentParser(description=
                     "Merge one or more .po files into the first dest one.\n"
                     "If a msgkey (msgctxt, msgid) is present in more than one merged po, the one in the first file "
                     "wins, unless it’s marked as fuzzy and one later is not.\n"
index 911e1764698efd978887a7e4b44552b208e5861a..524fef909e8a929f5ac400c6f0ffd3bc786f23e3 100644 (file)
@@ -31,9 +31,10 @@ import sys
 import tempfile
 #import time
 
-from bl_i18n_utils import (settings,
-                           utils_rtl,
-                          )
+from bl_i18n_utils import (
+        settings,
+        utils_rtl,
+        )
 
 import bpy
 
index 874efc2e131978a43e0ed0723d0df8da923a56a8..25a6c7242e0dc4216fefc2b6827513c0fb7339d6 100644 (file)
@@ -43,10 +43,11 @@ __all__ = (
 import bpy as _bpy
 import os as _os
 
-from _bpy_path import (extensions_audio,
-                       extensions_movie,
-                       extensions_image,
-                       )
+from _bpy_path import (
+        extensions_audio,
+        extensions_movie,
+        extensions_image,
+        )
 
 
 def _getattr_bytes(var, attr):
index bf882db74d9de3867e846ee0f07623156595c41b..5f235ae3958238676486550f2ecf392e927ed53e 100644 (file)
@@ -51,12 +51,12 @@ __all__ = (
     )
 
 from _bpy import (
-    escape_identifier,
-    register_class,
-    unregister_class,
-    blend_paths,
-    resource_path,
-    )
+        escape_identifier,
+        register_class,
+        unregister_class,
+        blend_paths,
+        resource_path,
+        )
 from _bpy import script_paths as _bpy_script_paths
 from _bpy import user_resource as _user_resource
 from _bpy import _utils_units as units
index 449a4cef1efdc0e4aab5fa8690f577b28b7954e7..dfb734e9b5b0c92790b8fc6acc494d1f8ddb118b 100644 (file)
 import bpy
 from bpy.types import Operator
 
-from bpy.props import (FloatProperty,
-                       IntProperty,
-                       )
+from bpy.props import (
+        FloatProperty,
+        IntProperty,
+        )
 from bpy.app.translations import pgettext_data as data_
 
 from bpy_extras import object_utils
index 36445d742e2497d52607b59449403f8032c14278..1b3e719b2bd6c0678b75b374cd2351d03493f78e 100644 (file)
@@ -27,11 +27,12 @@ if "bpy" in locals():
 
 import bpy
 from bpy.types import Operator
-from bpy.props import (IntProperty,
-                       BoolProperty,
-                       EnumProperty,
-                       StringProperty,
-                       )
+from bpy.props import (
+        IntProperty,
+        BoolProperty,
+        EnumProperty,
+        StringProperty,
+        )
 
 
 class ANIM_OT_keying_set_export(Operator):
index 4e99acd4f36b29578916a991c89303cd6c6c05f5..8cfc977294a6bf65302b7f02a0a5ea157927700e 100644 (file)
 
 import bpy
 from bpy.types import Operator
-from bpy.props import (BoolProperty,
-                       StringProperty,
-                       )
+from bpy.props import (
+        BoolProperty,
+        StringProperty,
+        )
 
 
 def _lang_module_get(sc):
index 453be519abf3c0a6b67e405384d9c0c54f51f368..edda92284d234542485d1ff00c6a5f97b0cc9389 100644 (file)
 #
 # ##### END GPL LICENSE BLOCK #####
 
-import sys
 import bpy
 
-from bpy.props import (BoolProperty, EnumProperty, StringProperty)
+from bpy.props import (
+        BoolProperty,
+        EnumProperty,
+        StringProperty,
+        )
 
 
 class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
@@ -29,11 +32,16 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
     bl_label = "Fill Range by Selection"
     bl_options = {'INTERNAL'}
 
-    type = EnumProperty(name="Type", description="Type of the modifier to work on",
-                        items=(("COLOR", "Color", "Color modifier type"),
-                               ("ALPHA", "Alpha", "Alpha modifier type"),
-                               ("THICKNESS", "Thickness", "Thickness modifier type")))
-    name = StringProperty(name="Name", description="Name of the modifier to work on")
+    type = EnumProperty(
+            name="Type", description="Type of the modifier to work on",
+            items=(("COLOR", "Color", "Color modifier type"),
+                   ("ALPHA", "Alpha", "Alpha modifier type"),
+                   ("THICKNESS", "Thickness", "Thickness modifier type")),
+            )
+    name = StringProperty(
+            name="Name",
+            description="Name of the modifier to work on",
+            )
 
     @classmethod
     def poll(cls, context):
@@ -41,6 +49,8 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
         return rl and rl.freestyle_settings.linesets.active
 
     def execute(self, context):
+        import sys
+
         scene = context.scene
         rl = scene.render.layers.active
         lineset = rl.freestyle_settings.linesets.active
index 9bdd928970032c1f233c31f66ab49743122ce532..264cfa349926500a909ec02a5a7cdbd61cc293a8 100644 (file)
 
 import bpy
 import nodeitems_utils
-from bpy.types import (Operator,
-                       PropertyGroup,
-                       )
-from bpy.props import (BoolProperty,
-                       CollectionProperty,
-                       EnumProperty,
-                       IntProperty,
-                       StringProperty,
-                       )
+from bpy.types import (
+        Operator,
+        PropertyGroup,
+        )
+from bpy.props import (
+        BoolProperty,
+        CollectionProperty,
+        EnumProperty,
+        IntProperty,
+        StringProperty,
+        )
 
 
 class NodeSetting(PropertyGroup):
index c1f75c74bb49cc28ce82c201dadc36afd062ff8e..1f8c89b2fd929e16a698268298b1044d29bb920d 100644 (file)
 
 import bpy
 from bpy.types import Operator
-from bpy.props import (StringProperty,
-                       BoolProperty,
-                       EnumProperty,
-                       IntProperty,
-                       FloatProperty)
+from bpy.props import (
+        StringProperty,
+        BoolProperty,
+        EnumProperty,
+        IntProperty,
+        FloatProperty,
+        )
 
 
 class SelectPattern(Operator):
index 06dc82d2b77826db77c4e5ef20213e4cc3917b49..495b671a2ef0156d876a9580ba0351488670529e 100644 (file)
 from mathutils import Vector
 import bpy
 from bpy.types import Operator
-from bpy.props import (BoolProperty,
-                       EnumProperty,
-                       IntProperty,
-                       FloatProperty,
-                       FloatVectorProperty,
-                       )
+from bpy.props import (
+        BoolProperty,
+        EnumProperty,
+        IntProperty,
+        FloatProperty,
+        FloatVectorProperty,
+        )
 
 
 def object_ensure_material(obj, mat_name):
index e7f48eccbf1889888c3cfc836346a7fb1f323086..53bf52498b1a7fab5663eb827aed19f782f51381 100644 (file)
 
 import bpy
 from bpy.types import Operator
-from bpy.props import (StringProperty,
-                       BoolProperty,
-                       IntProperty,
-                       FloatProperty,
-                       EnumProperty,
-                       )
+from bpy.props import (
+        StringProperty,
+        BoolProperty,
+        IntProperty,
+        FloatProperty,
+        EnumProperty,
+        )
 
 from bpy.app.translations import pgettext_tip as tip_
 
index 6a8f9c586eda02a87a5daf925806e64f6e170a0e..9453e9a4690688db7b35f05514af2ce51536c1ef 100644 (file)
@@ -278,9 +278,10 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
                 row.prop(itasc, "damping_max", text="Damp", slider=True)
                 row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
 
-from bl_ui.properties_animviz import (MotionPathButtonsPanel,
-                                      OnionSkinButtonsPanel,
-                                      )
+from bl_ui.properties_animviz import (
+        MotionPathButtonsPanel,
+        OnionSkinButtonsPanel,
+        )
 
 
 class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
index 9c94c9cf7d576ace47facaae290716aa6d14071f..13a9b88f1691a7ecbf1e4fa265c3b4446d686c08 100644 (file)
@@ -230,9 +230,10 @@ class DATA_PT_camera_safe_areas(CameraButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
-        cam = context.camera
+        safe_data = context.scene.safe_areas
+        camera = context.camera
 
-        draw_display_safe_settings(layout, cam)
+        draw_display_safe_settings(layout, safe_data, camera)
 
 
 class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel):
@@ -241,9 +242,7 @@ class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, Panel):
     _property_type = bpy.types.Camera
 
 
-def draw_display_safe_settings(layout, settings):
-
-    safe_data = bpy.context.scene.safe_areas
+def draw_display_safe_settings(layout, safe_data, settings):
     show_safe_areas = settings.show_safe_areas
     show_safe_center = settings.show_safe_center
 
index 25367a58a542c2162fd2c2e4a40bbed246f91235..b822b65bc512ba46317394dc147a3d6d67b39792 100644 (file)
@@ -323,8 +323,10 @@ class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
         layout.prop(ob, "use_extra_recalc_data")
 
 
-from bl_ui.properties_animviz import (MotionPathButtonsPanel,
-                                      OnionSkinButtonsPanel)
+from bl_ui.properties_animviz import (
+        MotionPathButtonsPanel,
+        OnionSkinButtonsPanel,
+        )
 
 
 class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
index 1176245da831b5ff6a3606e099b6e9ea5f6092af..681898d1659d7c715f5239823ea068d3a39bc5fa 100644 (file)
@@ -22,11 +22,12 @@ from bpy.types import Panel, Menu
 from rna_prop_ui import PropertyPanel
 from bpy.app.translations import pgettext_iface as iface_
 
-from bl_ui.properties_physics_common import (point_cache_ui,
-                                             effector_weights_ui,
-                                             basic_force_field_settings_ui,
-                                             basic_force_field_falloff_ui,
-                                             )
+from bl_ui.properties_physics_common import (
+        point_cache_ui,
+        effector_weights_ui,
+        basic_force_field_settings_ui,
+        basic_force_field_falloff_ui,
+        )
 
 
 def particle_panel_enabled(context, psys):
index 327ee4035ef6d6e56b190c372ce924300e6b31b7..45dd1bf5130ad5f90e6aba0100ecbe7e1bf10359 100644 (file)
 import bpy
 from bpy.types import Menu, Panel
 
-from bl_ui.properties_physics_common import (point_cache_ui,
-                                             effector_weights_ui)
+from bl_ui.properties_physics_common import (
+        point_cache_ui,
+        effector_weights_ui,
+        )
 
 
 def cloth_panel_enabled(md):
index 6a6d8dcff4abc6d0c81f75ca4a997b46cfe0c275..f8cca01380ac88a54e4d73bae3f16eb02753deb0 100644 (file)
 import bpy
 from bpy.types import Panel, UIList
 
-from bl_ui.properties_physics_common import (point_cache_ui,
-                                             effector_weights_ui,
-                                             )
+from bl_ui.properties_physics_common import (
+        point_cache_ui,
+        effector_weights_ui,
+        )
 
 
 class PHYSICS_UL_dynapaint_surfaces(UIList):
index 933a9aa12a3b8c51a0b85c0cef90ae1a661788a4..4a5c16a5a552dfc031b3e1937efeeaf96f2f9fc4 100644 (file)
 import bpy
 from bpy.types import Panel
 
-from bl_ui.properties_physics_common import (basic_force_field_settings_ui,
-                                             basic_force_field_falloff_ui,
-                                             )
+from bl_ui.properties_physics_common import (
+        basic_force_field_settings_ui,
+        basic_force_field_falloff_ui,
+        )
 
 
 class PhysicButtonsPanel():
index 5bdbbd70ee6d28ba51ddbf55ce75428d17d82508..426bf858bdb6c1b72ff955b0550be5c9971246a1 100644 (file)
 import bpy
 from bpy.types import Panel
 
-from bl_ui.properties_physics_common import (point_cache_ui,
-                                             effector_weights_ui)
+from bl_ui.properties_physics_common import (
+        point_cache_ui,
+        effector_weights_ui,
+        )
 
 
 class PhysicButtonsPanel():
index 17366f5901688cd462fc39acae79970d6b3b0f40..f96ab3f8cb1019db1c8efba4d809621278da9c7d 100644 (file)
 import bpy
 from bpy.types import Panel
 
-from bl_ui.properties_physics_common import (point_cache_ui,
-                                             effector_weights_ui)
+from bl_ui.properties_physics_common import (
+        point_cache_ui,
+        effector_weights_ui,
+        )
 
 
 def softbody_panel_enabled(md):
index 5e4c9314479ea7617654faa1418f155739d2279a..b3635acd392b19710779ab3cbcc28e6674713900 100644 (file)
@@ -22,9 +22,9 @@ from bpy.types import Panel, UIList
 from rna_prop_ui import PropertyPanel
 
 from bl_ui.properties_physics_common import (
-    point_cache_ui,
-    effector_weights_ui,
-    )
+        point_cache_ui,
+        effector_weights_ui,
+        )
 
 
 class SCENE_UL_keying_set_paths(UIList):
index 22e3152e50a56198340055ab08f84f92cff8f1dd..a0c4e0c92c38de8e3f5e22ec35935b8c49079084 100644 (file)
 import bpy
 from bpy.types import Menu, Panel, UIList
 
-from bpy.types import (Brush,
-                       Lamp,
-                       Material,
-                       Object,
-                       ParticleSettings,
-                       FreestyleLineStyle,
-                       Texture,
-                       World)
+from bpy.types import (
+        Brush,
+        FreestyleLineStyle,
+        Lamp,
+        Material,
+        Object,
+        ParticleSettings,
+        Texture,
+        World,
+        )
 
 from rna_prop_ui import PropertyPanel
 
index d2f2612c84efcf7f57665963cff320c21bbcbd12..e7c95bf1155fcb7e750f755eed67acd1903b2776 100644 (file)
@@ -1003,15 +1003,16 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
 # -----------------------------------------------------------------------------
 # Mask (similar code in space_image.py, keep in sync)
 
-
-from bl_ui.properties_mask_common import (MASK_PT_mask,
-                                          MASK_PT_layers,
-                                          MASK_PT_spline,
-                                          MASK_PT_point,
-                                          MASK_PT_display,
-                                          MASK_PT_tools,
-                                          MASK_PT_transforms,
-                                          MASK_PT_add)
+from bl_ui.properties_mask_common import (
+        MASK_PT_mask,
+        MASK_PT_layers,
+        MASK_PT_spline,
+        MASK_PT_point,
+        MASK_PT_display,
+        MASK_PT_tools,
+        MASK_PT_transforms,
+        MASK_PT_add,
+        )
 
 
 class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
index a302dab28c32f7c3f300e7c14a40969e24e42c54..f1dd594aaf92d62b15cffff6f6a80e8c7fb1d7b7 100644 (file)
@@ -28,7 +28,7 @@ from bl_ui.properties_paint_common import (
 from bl_ui.properties_grease_pencil_common import (
         GreasePencilDrawingToolsPanel,
         GreasePencilStrokeEditPanel,
-        GreasePencilDataPanel
+        GreasePencilDataPanel,
         )
 from bpy.app.translations import pgettext_iface as iface_
 
@@ -515,12 +515,14 @@ class MASK_MT_editor_menus(Menu):
 # Mask (similar code in space_clip.py, keep in sync)
 # note! - panel placement does _not_ fit well with image panels... need to fix
 
-from bl_ui.properties_mask_common import (MASK_PT_mask,
-                                          MASK_PT_layers,
-                                          MASK_PT_spline,
-                                          MASK_PT_point,
-                                          MASK_PT_display,
-                                          MASK_PT_tools)
+from bl_ui.properties_mask_common import (
+        MASK_PT_mask,
+        MASK_PT_layers,
+        MASK_PT_spline,
+        MASK_PT_point,
+        MASK_PT_display,
+        MASK_PT_tools,
+        )
 
 
 class IMAGE_PT_mask(MASK_PT_mask, Panel):
index bf63b8479960b6cb22d2491f6b4d68bc0165370d..76c579f221f83e7b9fc88506fa7e6ff0291a35cb 100644 (file)
@@ -22,7 +22,6 @@ from bpy.types import Header, Menu, Panel
 from bl_ui.properties_grease_pencil_common import GreasePencilDataPanel, GreasePencilToolsPanel
 from bpy.app.translations import pgettext_iface as iface_
 
-from bl_ui.properties_data_camera import draw_display_safe_settings
 
 def act_strip(context):
     try:
@@ -1000,10 +999,13 @@ class SEQUENCER_PT_view_safe_areas(SequencerButtonsPanel_Output, Panel):
         self.layout.prop(st, "show_safe_areas", text="")
 
     def draw(self, context):
+        from bl_ui.properties_data_camera import draw_display_safe_settings
+
         layout = self.layout
         st = context.space_data
+        safe_data = context.scene.safe_areas
 
-        draw_display_safe_settings(layout, st)
+        draw_display_safe_settings(layout, safe_data, st)
 
 
 class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):