From 2fab4324b03a9f916e71a214845f7da18c3969b3 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 7 Jan 2009 14:45:45 +0000 Subject: [PATCH] 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 --- wizard/BCpuPage.py | 10 ++++++---- wizard/BToolchainPage.py | 12 +++++++++--- wizard/bertos.qrc | 1 + wizard/bertos_utils.py | 20 ++++++++++++-------- wizard/images/error.png | Bin 0 -> 9176 bytes 5 files changed, 28 insertions(+), 15 deletions(-) create mode 100755 wizard/images/error.png 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 0000000000000000000000000000000000000000..6e0ea6e382a9d8d257f02e1ad608aa1a8e87e764 GIT binary patch literal 9176 zcma)Cg;x~J*Iri zmi%~sf5A8B%-l2g%skKBd(X_7xo4tuUZ^}Gq$LCZ0FTsE6?GpZ;=c;QduV%Pt%n{2 z&;zEX4|*s8pf`~ZeF9fiV~>aNbN^K=7-y#MgYt=|l98vL%R5gWYxlPRA0Hon`}d9> zHrB3h`CZ&?GY_O`0RU!znxeeEZ`OYH2VY8qmV3DpKds3fw!e8HP-p}6Csm3$F7CVU zd+cAx-@J77d8cUGhHe%aEftKEVx>)GV}t%wc`T2ATuXq&jzfLHUi(fydzN9bcXPLW zz!o~XWE_xmcse~bZcrvQv#i~|RjId?MXsw(s}C=l_Qs;sZ*>6VswI2hB?D@93?xIA)@59!8N)SxJp>Dc=?=poTbso@);DNkbeQ#!=WN8#h`k) z&LErQi8M$43{siGh!PjAEK*GL#)T55XS(r)3h)d#k|s#T)wQJnoHI9slyU2-vq_^@ zZGl~QkWE!z3+(8AkKa-+&*aLZLkY-h#iz-EVkDidO2cUYT^3$y{Spzo4n^$AJta4( zkYz;Z)-u)W_gZOZ!VlKwv8>*aJ*z-MN_m~;!3WUe}^>M^P(&94vBIi4M zQOg=tG#5WUfzlXa2k>V?4*Qw9_V_wt=DnUEt>)iZUKEw1HaA%+4JWwyDOVM|q+SYG z01fzBHWVEmKyX%a`@Y`nQFFa~BdbLogtE`v6pg+m=(8aWyI&jn3!jw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