X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=a30aaed4cdb37f0a3f4c234d67c801ae4f587dfd;hb=bfab81f21ec1f468ae3f96fbee651636789c15ed;hp=c19f3d5322503c356394d1f1a25d246ea8dec788;hpb=3cd73c355f9d5bd07eaee38425661f5f4310f020;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index c19f3d53..a30aaed4 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -45,7 +45,6 @@ import pickle import const import plugins import DefineException -import BProject from _wizard_version import WIZARD_VERSION @@ -76,6 +75,26 @@ def enabledModules(project_info): enabled_modules.append(name) return enabled_modules +def presetList(directory): + """ + Return the list of the preset found in the selected BeRTOS Version. + """ + def getPresetInfo(preset_dir): + # Find and returns information about the preset + # Keys needed for BBoardPage: + # - "name": + # - "description": + + # NOTE: this is only a test stub. + preset_info = pickle.loads(open(os.path.join(preset_dir, 'info'), "r").read()) + return preset_info + abspath = os.path.join(directory, const.PREDEFINED_BOARDS_DIR) + preset_list = dict([ + (os.path.join(abspath, preset_dir), getPresetInfo(os.path.join(abspath, preset_dir))) + for preset_dir in os.listdir(os.path.join(directory, const.PREDEFINED_BOARDS_DIR)) + ]) + return preset_list + def mergeSources(srcdir, new_sources, old_sources): # The current mergeSources function provide only a raw copy of the sources in the # created project.