From: duplo Date: Tue, 24 Mar 2009 13:32:47 +0000 (+0000) Subject: Try to find the type of the parameter automatically if it isn't defined manually X-Git-Tag: 2.1.0~270 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=37a6db28f23f5fce42e2e3f3f91274f77a1ba41e;p=bertos.git Try to find the type of the parameter automatically if it isn't defined manually git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2412 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 68483edc..f4732ede 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -429,6 +429,7 @@ def loadConfigurationInfos(path): "min": the minimum value for integer parameters "max": the maximum value for integer parameters "long": boolean indicating if the num is a long + "unsigned": boolean indicating if the num is an unsigned "value_list": the name of the enum for enum parameters """ configurationInfos = {} @@ -438,6 +439,8 @@ def loadConfigurationInfos(path): configurationInfos[name] = {} configurationInfos[name]["value"] = value configurationInfos[name]["informations"] = informations + if not "type" in configurationInfos[name]["informations"]: + configurationInfos[name]["informations"]["type"] = findParameterType(configurationInfos[name]) if ("type" in configurationInfos[name]["informations"].keys() and configurationInfos[name]["informations"]["type"] == "int" and configurationInfos[name]["value"].find("L") != -1): @@ -452,6 +455,12 @@ def loadConfigurationInfos(path): configurationInfos[name]["brief"] = brief return configurationInfos +def findParameterType(parameter): + if "value_list" in parameter["informations"]: + return "enum" + if "min" in parameter["informations"] or "max" in parameter["informations"] or re.match(r"^\d+U?L?$", parameter["value"]) != None: + return "int" + def sub(string, parameter, value): """ Substitute the given value at the given parameter define in the given string