folder_item = QTreeWidgetItem(folder_title, QStringList([os.path.normpath(self.projectInfo("PROJECT_PATH"))]))
top_level.append(folder_title)
version_title = QTreeWidgetItem(QStringList([self.tr("BeRTOS version")]))
- sources_path = self.projectInfo("SOURCES_PATH")
+ sources_path = self.projectInfo("BERTOS_PATH")
version = QTreeWidgetItem(version_title, QStringList([self.tr("version: ") + bertos_utils.bertosVersion(sources_path)]))
source_path = QTreeWidgetItem(version_title, QStringList([self.tr("path: ") + os.path.normpath(sources_path)]))
top_level.append(version_title)
dialog.toolchain_page.setProjectInfo("TOOLCHAIN", toolchain)
def changeBertosVersion(self):
- current_version = self.module_page.projectInfo("SOURCES_PATH")
+ current_version = self.module_page.projectInfo("BERTOS_PATH")
dialog = BVersionDialog()
if dialog.exec_():
version = qvariant_converter.getString(dialog.version_page.currentItem().data(Qt.UserRole))
) == QMessageBox.Ok:
try:
qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
- dialog.version_page.setProjectInfo("SOURCES_PATH", version)
- dialog.version_page.setProjectInfo("OLD_SOURCES_PATH", current_version)
+ dialog.version_page.setProjectInfo("BERTOS_PATH", version)
+ dialog.version_page.setProjectInfo("OLD_BERTOS_PATH", current_version)
enabled_modules = bertos_utils.enabledModules(dialog.version_page.project)
old_configuration = dialog.version_page.projectInfo("CONFIGURATIONS")
dialog.version_page.project.loadSourceTree()
qApp.restoreOverrideCursor()
else:
# Rollback version to the previous selected one.
- dialog.version_page.setProjectInfo("SOURCES_PATH", current_version)
+ dialog.version_page.setProjectInfo("BERTOS_PATH", current_version)
def apply(self):
try:
return self.module_page.versions()
def currentVersion(self):
- return self.module_page.projectInfo("SOURCES_PATH")
+ return self.module_page.projectInfo("BERTOS_PATH")
def setCurrentVersion(self, version):
- self.module_page.setProjectInfo("SOURCES_PATH", version)
+ self.module_page.setProjectInfo("BERTOS_PATH", version)
class BToolchainDialog(QDialog):
def __init__(self):
layout.addLayout(button_layout)
self.setLayout(layout)
self.connect(ok_button, SIGNAL("clicked()"), self.accept)
- current_version = version_page.projectInfo("SOURCES_PATH")
+ current_version = version_page.projectInfo("BERTOS_PATH")
self.setWindowTitle(self.tr("Change BeRTOS version"))
wizard_version = project_data.get("WIZARD_VERSION", 0)
if wizard_version < 1:
- # Ignore the SOURCES_PATH inside the project file for older project
- project_data["SOURCES_PATH"] = project_dir
+ # Ignore the BERTOS_PATH inside the project file for older project
+ project_data["BERTOS_PATH"] = project_dir
else:
- linked_sources_path = project_data["SOURCES_PATH"]
+ linked_sources_path = project_data["BERTOS_PATH"]
sources_abspath = os.path.abspath(os.path.join(project_dir, linked_sources_path))
- project_data["SOURCES_PATH"] = sources_abspath
+ project_data["BERTOS_PATH"] = sources_abspath
- self._loadBertosSourceStuff(project_data["SOURCES_PATH"], info_dict.get("SOURCES_PATH", None))
+ self._loadBertosSourceStuff(project_data["BERTOS_PATH"], info_dict.get("BERTOS_PATH", None))
self.infos["PRESET"] = project_data.get("PRESET", False)
if forced_version:
sources_path = forced_version
if os.path.exists(sources_path):
- self.infos["SOURCES_PATH"] = sources_path
+ self.infos["BERTOS_PATH"] = sources_path
else:
raise VersionException(self)
Load the default presets (into the const.PREDEFINED_BOARDS_DIR).
"""
# NOTE: this method does nothing (for now).
- preset_path = os.path.join(self.infos["SOURCES_PATH"], const.PREDEFINED_BOARDS_DIR)
+ preset_path = os.path.join(self.infos["BERTOS_PATH"], const.PREDEFINED_BOARDS_DIR)
preset_tree = {}
if os.path.exists(preset_path):
preset_tree = self._loadProjectPresetTree(preset_path)
if "configuration" in information and len(information["configuration"]):
configuration = module_dict[module]["configuration"]
try:
- configuration_info[configuration] = loadConfigurationInfos(self.infos["SOURCES_PATH"] + "/" + configuration)
+ configuration_info[configuration] = loadConfigurationInfos(self.infos["BERTOS_PATH"] + "/" + configuration)
except ParseError, err:
- raise DefineException.ConfigurationDefineException(self.infos["SOURCES_PATH"] + "/" + configuration, err.line_number, err.line)
+ raise DefineException.ConfigurationDefineException(self.infos["BERTOS_PATH"] + "/" + configuration, err.line_number, err.line)
if edit:
try:
path = self.infos["PROJECT_SRC_PATH"]
"""
Index BeRTOS source and load it in memory.
"""
- # Index only the SOURCES_PATH/bertos content
- bertos_sources_dir = os.path.join(self.info("SOURCES_PATH"), "bertos")
+ # Index only the BERTOS_PATH/bertos content
+ bertos_sources_dir = os.path.join(self.info("BERTOS_PATH"), "bertos")
file_dict = {}
if os.path.exists(bertos_sources_dir):
for element in os.walk(bertos_sources_dir):
@property
def old_srcdir(self):
- return self.infos.get("OLD_SOURCES_PATH", None)
+ return self.infos.get("OLD_BERTOS_PATH", None)
@property
def sources_dir(self):
- return self.infos.get("SOURCES_PATH", None)
+ return self.infos.get("BERTOS_PATH", None)
@property
def from_preset(self):
return [(filename, dirname) for dirname in file_dict.get(filename, [])]
def findDefinitions(self, ftype):
- # Maintain a cache for every scanned SOURCES_PATH
- definitions_dict = self._cached_queries.get(self.infos["SOURCES_PATH"], {})
+ # Maintain a cache for every scanned BERTOS_PATH
+ definitions_dict = self._cached_queries.get(self.infos["BERTOS_PATH"], {})
definitions = definitions_dict.get(ftype, None)
if definitions is not None:
return definitions
if fnmatch.fnmatch(filename, ftype):
definitions += [(filename, dirname) for dirname in file_dict.get(filename, [])]
- # If no cache for the current SOURCES_PATH create an empty one
+ # If no cache for the current BERTOS_PATH create an empty one
if not definitions_dict:
- self._cached_queries[self.infos["SOURCES_PATH"]] = {}
+ self._cached_queries[self.infos["BERTOS_PATH"]] = {}
# Fill the empty cache with the result
- self._cached_queries[self.infos["SOURCES_PATH"]][ftype] = definitions
+ self._cached_queries[self.infos["BERTOS_PATH"]][ftype] = definitions
return definitions
def setEnabledModules(self, enabled_modules):
# Remove the trailing slash
if sources_path.endswith(os.sep):
sources_path = sources_path[:-1]
- self.setProjectInfo("SOURCES_PATH", sources_path)
+ self.setProjectInfo("BERTOS_PATH", sources_path)
return True
else:
return False
"""
versions = set([])
if self._edit:
- versions.add(self.projectInfo("SOURCES_PATH"))
+ versions.add(self.projectInfo("BERTOS_PATH"))
if os.name == "nt":
import winreg_importer
versions |= set([os.path.normpath(dir) for dir in winreg_importer.getBertosDirs()])
versions |= set([os.path.normpath(dir) for dir in self.versions()])
- selected = self.projectInfo("SOURCES_PATH")
+ selected = self.projectInfo("BERTOS_PATH")
for directory in versions:
item = self.insertListElement(directory)
if selected and selected == directory:
# Previous versions:
# 0 - the project file doesn't contain the version number.
# When the current Wizard is opening project done with this version of
-# the Wizard it has to change the origina SOURCES_PATH to the local path
+# the Wizard it has to change the origina BERTOS_PATH to the local path
# 1 - this is the current version. No special behaviours needed.
dialog = BVersionDialog()
if dialog.exec_():
version = dialog.version_page.currentVersion()
- info_dict["SOURCES_PATH"] = version
+ info_dict["BERTOS_PATH"] = version
continue
except ToolchainException, exc:
QMessageBox.critical(
enabled_modules.append(module)
project_data["ENABLED_MODULES"] = enabled_modules
if project_info.info("PRESET"):
- # For presets save again the SOURCES_PATH into project file
+ # For presets save again the BERTOS_PATH into project file
project_data["PRESET"] = True
- project_data["SOURCES_PATH"] = project_info.info("SOURCES_PATH")
+ project_data["BERTOS_PATH"] = project_info.info("BERTOS_PATH")
else:
# Use the local BeRTOS version instead of the original one
- # project_data["SOURCES_PATH"] = project_info.info("SOURCES_PATH")
- project_data["SOURCES_PATH"] = directory
+ # project_data["BERTOS_PATH"] = project_info.info("BERTOS_PATH")
+ project_data["BERTOS_PATH"] = directory
project_data["PROJECT_NAME"] = project_info.info("PROJECT_NAME", os.path.basename(directory))
project_data["PROJECT_SRC_PATH"] = project_info.info("PROJECT_SRC_PATH")
project_data["TOOLCHAIN"] = project_info.info("TOOLCHAIN")
return getattr(__import__("plugins", {}, {}, [plugin]), plugin)
def versionFileGenerator(project_info, version_file):
- version = bertosVersion(project_info.info("SOURCES_PATH"))
+ version = bertosVersion(project_info.info("BERTOS_PATH"))
return version_file.replace('$version', version)
def userMkGenerator(project_info, makefile):
sfiles = []
# .c files related to the module and the cpu architecture
for filename, path in project_info.searchFiles(module + ".c"):
- path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
path = replaceSeparators(path)
cfiles.append(path + "/" + filename)
# .s files related to the module and the cpu architecture
for filename, path in project_info.searchFiles(module + ".s") + \
project_info.searchFiles(module + ".S"):
- path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
path = replaceSeparators(path)
sfiles.append(path + "/" + filename)
# .c and .s files related to the module and the cpu tags
# Awful, but secure check for version
# TODO: split me in a method/function
try:
- version_string = bertosVersion(project_info.info("SOURCES_PATH"))
+ version_string = bertosVersion(project_info.info("BERTOS_PATH"))
version_list = [int(i) for i in version_string.split()[-1].split('.')]
if version_list < [2, 5]:
# For older versions of BeRTOS add the toolchain to the tags
for tag in tags:
for filename, path in project_info.searchFiles(module + "_" + tag + ".c"):
- path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
if os.sep != "/":
path = replaceSeparators(path)
cfiles.append(path + "/" + filename)
for filename, path in project_info.searchFiles(module + "_" + tag + ".s") + \
project_info.searchFiles(module + "_" + tag + ".S"):
- path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "")
+ path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "")
path = replaceSeparators(path)
sfiles.append(path + "/" + filename)
return cfiles, sfiles
def main():
p = BProject.BProject()
- p.setInfo("SOURCES_PATH", "../../")
+ p.setInfo("BERTOS_PATH", "../../")
p.loadSourceTree()
info = p.getCpuInfos()
tags = getTagSet(info)
def main():
p = BProject.BProject()
- p.setInfo("SOURCES_PATH", "../../")
+ p.setInfo("BERTOS_PATH", "../../")
p.loadProjectPresets()
app = QApplication([])
app.project = BProject.BProject()
page = BModulePage.BModulePage()
- page.setProjectInfo("SOURCES_PATH", "../../")
+ page.setProjectInfo("BERTOS_PATH", "../../")
page.setProjectInfo("CPU_INFOS", {"TOOLCHAIN": "avr", "CPU_TAGS": []})
page.project().loadSourceTree()
page.reloadData()