X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=wizard%2FBToolchainPage.py;h=546a7e0b908c937b604e6ee27e6df297de38b348;hb=2b542ab21bf9f3df4e564e38e0c9db2c180449bd;hp=b344ce2536baf38cfede2ba922c63535174d7190;hpb=03fc128d13180a389d42c9720882187c21e8f6ed;p=bertos.git
diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py
index b344ce25..546a7e0b 100644
--- a/wizard/BToolchainPage.py
+++ b/wizard/BToolchainPage.py
@@ -18,6 +18,7 @@ class BToolchainPage(BWizardPage):
def __init__(self):
BWizardPage.__init__(self, "toolchain_select.ui")
self.setTitle(self.tr("Select toolchain"))
+ self._validationProcess = None
self._populateToolchainList()
self._connectSignals()
@@ -45,13 +46,35 @@ class BToolchainPage(BWizardPage):
self.emit(SIGNAL("completeChanged()"))
def _search(self):
- pass
+ dirList = [unicode(element.toString()) for element in self._settingsRetrieve("search_dir_list").toList()]
+ if(self._settingsRetrieve("path_search").toBool()):
+ dirList += [element for element in bertos_utils.getSystemPath()]
+ toolchainList = bertos_utils.findToolchains(dirList)
+ storedToolchainList = self._settingsRetrieve("toolchains").toList()
+ storedToolchainList = set([unicode(toolchain.toString()) for toolchain in storedToolchainList])
+ toolchainList =set(toolchainList) - set(storedToolchainList)
+ for element in toolchainList:
+ item = QListWidgetItem(element)
+ item.setData(Qt.UserRole, QVariant(element))
+ self.pageContent.toolchainList.addItem(item)
+ self._settingsStore("toolchains", list(toolchainList.union(storedToolchainList)))
def _connectSignals(self):
self.connect(self.pageContent.toolchainList, SIGNAL("itemSelectionChanged()"), self._selectionChanged)
self.connect(self.pageContent.addButton, SIGNAL("clicked()"), self.addToolchain)
self.connect(self.pageContent.removeButton, SIGNAL("clicked()"), self.removeToolchain)
self.connect(self.pageContent.searchButton, SIGNAL("clicked()"), self.searchToolchain)
+ self.connect(self.pageContent.checkButton, SIGNAL("clicked()"), self.validateToolchains)
+
+ def _validItem(self, index, infos):
+ item = self.pageContent.toolchainList.item(index)
+ item.setIcon(QIcon(":/images/ok.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"))
def addToolchain(self):
sel_toolchain = QFileDialog.getOpenFileName(self, self.tr("Choose the toolchain"), "")
@@ -68,7 +91,7 @@ class BToolchainPage(BWizardPage):
item = self.pageContent.toolchainList.takeItem(self.pageContent.toolchainList.currentRow())
item = item.data(Qt.UserRole).toString()
toolchains = self._settingsRetrieve("toolchains").toList()
- toolchains = [toolchain.toString() for toolchain in toolchains]
+ toolchains = [unicode(toolchain.toString()) for toolchain in toolchains]
toolchains.remove(unicode(item))
self._settingsStore("toolchains", toolchains)
@@ -77,6 +100,23 @@ class BToolchainPage(BWizardPage):
self.connect(search, SIGNAL("accepted()"), self._search)
search.exec_()
+ def validateToolchains(self):
+ for i in range(self.pageContent.toolchainList.count()):
+ filename = self.pageContent.toolchainList.item(i).text()
+ self._validationProcess = QProcess()
+ self._validationProcess.start(filename, ["-v"])
+ self._validationProcess.waitForStarted(10)
+ if self._validationProcess.waitForFinished(10):
+ description = str(self._validationProcess.readAllStandardError())
+ infos = bertos_utils.getToolchainInfo(description)
+ if len(infos.keys()) == 4:
+ self._validItem(i, infos)
+ else:
+ self._invalidItem(i)
+ else:
+ self._validationProcess.kill()
+ self._invalidItem(i)
+
def isComplete(self):
if self.pageContent.toolchainList.currentRow() != -1:
self._projectInfoStore("TOOLCHAIN", self.pageContent.toolchainList.item(self.pageContent.toolchainList.currentRow()).data(Qt.UserRole).toString())