From: duplo Date: Wed, 7 Jan 2009 14:45:45 +0000 (+0000) Subject: Add the check for the right toolchain for the selected cpu X-Git-Tag: 2.1.0~547 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=2fab4324b03a9f916e71a214845f7da18c3969b3;p=bertos.git Add the check for the right toolchain for the selected cpu git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2135 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index 93919c9c..f35790b8 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -29,7 +29,7 @@ class BCpuPage(BWizardPage): item = QListWidgetItem(cpu["CPU_NAME"]) # The CPU_DESC field in the cpu definition is a list of string, so we need to # store it as a QStringList in a QVariant - item.setData(Qt.UserRole, QVariant(QStringList(cpu["CPU_DESC"]))) + item.setData(Qt.UserRole, QVariant(cpu)) self.pageContent.cpuList.addItem(item) def _connectSignals(self): @@ -54,15 +54,17 @@ class BCpuPage(BWizardPage): def isComplete(self): if self.pageContent.cpuList.currentRow() != -1: - self._projectInfoStore("CPU_NAME", self.pageContent.cpuList.currentItem().text()) + self._projectInfoStore("CPU_INFOS", self.pageContent.cpuList.currentItem().data(Qt.UserRole).toMap()) return True else: return False def rowChanged(self): - description = self.pageContent.cpuList.currentItem().data(Qt.UserRole).toStringList() + description = self.pageContent.cpuList.currentItem().data(Qt.UserRole).toMap() + # I don't like to use QString as key in the dict, but the QVariant.toMap() return a dict + description = description[QString("CPU_DESC")].toStringList() # We need to convert the list of QString in a list of unicode - description = [unicode(line) for line in description] + description = [unicode(line) for line in description] self.pageContent.descriptionLabel.setText("
".join(description)) self.pageContent.descriptionLabel.setVisible(True) self.emit(SIGNAL("completeChanged()")) diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index 546a7e0b..6c43ec10 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -9,6 +9,8 @@ # Author: Lorenzo Berni # +import os + from BWizardPage import * import BToolchainSearch import bertos_utils @@ -68,13 +70,17 @@ class BToolchainPage(BWizardPage): def _validItem(self, index, infos): item = self.pageContent.toolchainList.item(index) - item.setIcon(QIcon(":/images/ok.png")) + needed = self._projectInfoRetrieve("CPU_INFOS") + if infos["target"].find(unicode(needed[QString("TOOLCHAIN")])) != -1: + item.setIcon(QIcon(":/images/ok.png")) + else: + item.setIcon(QIcon(":/images/warning.png")) item.setToolTip("Version: " + infos["version"] + "
Target: " + infos["target"] + "
Thread model: " + infos["thread"]) def _invalidItem(self, index): item = self.pageContent.toolchainList.item(index) - item.setIcon(QIcon(":/images/warning.png")) + item.setIcon(QIcon(":/images/error.png")) def addToolchain(self): sel_toolchain = QFileDialog.getOpenFileName(self, self.tr("Choose the toolchain"), "") @@ -106,7 +112,7 @@ class BToolchainPage(BWizardPage): self._validationProcess = QProcess() self._validationProcess.start(filename, ["-v"]) self._validationProcess.waitForStarted(10) - if self._validationProcess.waitForFinished(10): + if self._validationProcess.waitForFinished(20): description = str(self._validationProcess.readAllStandardError()) infos = bertos_utils.getToolchainInfo(description) if len(infos.keys()) == 4: diff --git a/wizard/bertos.qrc b/wizard/bertos.qrc index 8249cc1a..3704b483 100644 --- a/wizard/bertos.qrc +++ b/wizard/bertos.qrc @@ -6,6 +6,7 @@ images/listadd.png images/ok.png images/warning.png + images/error.png images/folderopen.png diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index ed66a3b8..99a84414 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -71,12 +71,16 @@ def findDefinitions(ftype, path): def loadCpuInfos(path): cpuInfos = [] for definition in findDefinitions(const.CPU_DEFINITION, path): - D = {} - D.update(const.CPU_DEF) - def include(filename, dict = D, directory=definition[1]): - execfile(directory + "/" + filename, {}, D) - D["include"] = include - include(definition[0], D) - D["CPU_NAME"] = definition[0].split(".")[0] - cpuInfos.append(D) + cpuInfos.append(getInfos(definition)) return cpuInfos + +def getInfos(definition): + D = {} + D.update(const.CPU_DEF) + def include(filename, dict = D, directory=definition[1]): + execfile(directory + "/" + filename, {}, D) + D["include"] = include + include(definition[0], D) + D["CPU_NAME"] = definition[0].split(".")[0] + D["DEFINITION_PATH"] = definition[1] + "/" + definition[0] + return D \ No newline at end of file diff --git a/wizard/images/error.png b/wizard/images/error.png new file mode 100755 index 00000000..6e0ea6e3 Binary files /dev/null and b/wizard/images/error.png differ