Change the automatic setting of the autoenabled parameters
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 25 Aug 2009 15:08:41 +0000 (15:08 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 25 Aug 2009 15:08:41 +0000 (15:08 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2782 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos_utils.py

index 44911e5cce27fb3b05b9a3c9c08b9f555c969570..c59477e0a3c4f2df5c4d42f0ca21ec5080e3655c 100644 (file)
@@ -100,10 +100,10 @@ def projectFileGenerator(project_info):
     project_data["SELECTED_FREQ"] = project_info.info("SELECTED_FREQ")
     return pickle.dumps(project_data)
 
-def createBertosProject(project_info):
+def createBertosProject(project_info, edit=False):
     directory = project_info.info("PROJECT_PATH")
     sources_dir = project_info.info("SOURCES_PATH")
-    if os.path.isdir(directory):
+    if os.path.isdir(directory) and not edit:
         shutil.rmtree(directory, True)        
     os.makedirs(directory)
     f = open(directory + "/project.bertos", "w")
@@ -137,14 +137,14 @@ def createBertosProject(project_info):
     cfgdir = prjdir + "/cfg"
     shutil.rmtree(cfgdir, True)
     os.mkdir(cfgdir)
-    # Set to 1 the autoenabled for enabled modules
+    # Set properly the autoenabled parameters
     for module, information in project_info.info("MODULES").items():
-        if information["enabled"] and "configuration" in information and information["configuration"] != "":
+        if "configuration" in information and information["configuration"] != "":
             configurations = project_info.info("CONFIGURATIONS")
             configuration = configurations[information["configuration"]]
             for start, parameter in configuration["paramlist"]:
                 if "type" in configuration[parameter]["informations"] and configuration[parameter]["informations"]["type"] == "autoenabled":
-                    configuration[parameter]["value"] = "1"
+                    configuration[parameter]["value"] = "1" if information["enabled"] else "0"
             project_info.setInfo("CONFIGURATIONS", configurations)
     # Copy all the configuration files
     for configuration, information in project_info.info("CONFIGURATIONS").items():