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):
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<QString,QVariant>
+ 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("<br>".join(description))
self.pageContent.descriptionLabel.setVisible(True)
self.emit(SIGNAL("completeChanged()"))
# Author: Lorenzo Berni <duplo@develer.com>
#
+import os
+
from BWizardPage import *
import BToolchainSearch
import bertos_utils
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"] + "<br>Target: " + infos["target"] +
"<br>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"), "")
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:
<file>images/listadd.png</file>
<file>images/ok.png</file>
<file>images/warning.png</file>
+ <file>images/error.png</file>
<file>images/folderopen.png</file>
</qresource>
</RCC>
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