[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26379] trunk/blender/release/scripts: Add cfg folder for keyconfigs (and possibly others later) to be imported after everything else.

Martin Poirier theeth at yahoo.com
Thu Jan 28 22:52:07 CET 2010


Revision: 26379
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26379
Author:   theeth
Date:     2010-01-28 22:52:07 +0100 (Thu, 28 Jan 2010)

Log Message:
-----------
Add cfg folder for keyconfigs (and possibly others later) to be imported after everything else.

Also remove .pyc file when removing keyconfigs.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/release/scripts/ui/space_userpref.py

Added Paths:
-----------
    trunk/blender/release/scripts/cfg/

Modified: trunk/blender/release/scripts/modules/bpy/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/utils.py	2010-01-28 20:38:12 UTC (rev 26378)
+++ trunk/blender/release/scripts/modules/bpy/utils.py	2010-01-28 21:52:07 UTC (rev 26379)
@@ -72,7 +72,7 @@
             test_reload(_sys.modules[module_name])
 
     for base_path in script_paths():
-        for path_subdir in ("ui", "op", "io"):
+        for path_subdir in ("ui", "op", "io", "cfg"):
             path = _os.path.join(base_path, path_subdir)
             if _os.path.isdir(path):
 

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2010-01-28 20:38:12 UTC (rev 26378)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2010-01-28 21:52:07 UTC (rev 26379)
@@ -1502,13 +1502,15 @@
         
         f.close()
         
-        path = bpy.context.user_preferences.filepaths.python_scripts_directory
+        path = os.path.split(os.path.split(__file__)[0])[0] # remove ui/space_userpref.py
+        path = os.path.join(path, "cfg")
         
-        if not path:
-            path = os.path.split(__file__)[0]
+        # create config folder if needed
+        if not os.path.exists(path):
+            os.mkdir(path)        
+        
+        path = os.path.join(path, config_name + ".py")
             
-        path += os.path.sep + config_name + ".py"
-            
         if self.properties.keep_original:
             shutil.copy(self.properties.path, path)
         else:
@@ -1717,7 +1719,12 @@
         module = __import__(keyconfig.name)
         
         os.remove(module.__file__)
+
+        compiled_path = module.__file__ + "c" # for .pyc
         
+        if os.path.exists(compiled_path):
+            os.remove(compiled_path)
+        
         wm.remove_keyconfig(keyconfig)
         return {'FINISHED'}
 





More information about the Bf-blender-cvs mailing list