from BWizardPage import *
import BToolchainSearch
import bertos_utils
+import qvariant_converter
class BToolchainPage(BWizardPage):
self.pageContent.doSearchButton.setEnabled(False)
def _populateToolchainList(self):
- toolchains = self._settingsRetrieve("toolchains").toList()
+ toolchains = self.toolchains()
for element in toolchains:
- item = QListWidgetItem(element.toString())
- item.setData(Qt.UserRole, element)
+ item = QListWidgetItem(element)
+ item.setData(Qt.UserRole, QVariant(element))
self.pageContent.toolchainList.addItem(item)
def _clearList(self):
self.emit(SIGNAL("completeChanged()"))
def _search(self):
- dirList = [unicode(element.toString()) for element in self._settingsRetrieve("search_dir_list").toList()]
- if(self._settingsRetrieve("path_search").toBool()):
+ dirList = self.searchDirList()
+ if(self.pathSearch()):
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)
+ storedToolchainList = self.toolchains()
+ 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)))
+ self.setToolchains(list(toolchainList.union(storedToolchainList)))
def _connectSignals(self):
self.connect(self.pageContent.toolchainList, SIGNAL("itemSelectionChanged()"), self._selectionChanged)
def _validItem(self, index, infos):
item = self.pageContent.toolchainList.item(index)
needed = self._projectInfoRetrieve("CPU_INFOS")
- if infos["target"].find(unicode(needed[QString("TOOLCHAIN")])) != -1:
+ if infos["target"].find(needed["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"])
+ item.setText(infos["version"] + " " + infos["target"])
def _invalidItem(self, index):
item = self.pageContent.toolchainList.item(index)
item = QListWidgetItem(sel_toolchain)
item.setData(Qt.UserRole, QVariant(sel_toolchain))
self.pageContent.toolchainList.addItem(item)
- toolchains = self._settingsRetrieve("toolchains").toList()
- toolchains = set([toolchain.toString() for toolchain in toolchains] + [sel_toolchain])
- self._settingsStore("toolchains", list(toolchains))
+ toolchains = self.toolchains()
+ toolchains = set(toolchains + [sel_toolchain])
+ self.setToolchains(list(toolchains))
def removeToolchain(self):
if self.pageContent.toolchainList.currentRow() != -1:
item = self.pageContent.toolchainList.takeItem(self.pageContent.toolchainList.currentRow())
- item = item.data(Qt.UserRole).toString()
- toolchains = self._settingsRetrieve("toolchains").toList()
- toolchains = [unicode(toolchain.toString()) for toolchain in toolchains]
- toolchains.remove(unicode(item))
- self._settingsStore("toolchains", toolchains)
+ toolchain = qvariant_converter.getString(item.data(Qt.UserRole))
+ toolchains = self.toolchains()
+ toolchains.remove(toolchain)
+ self.setToolchains(toolchains)
def searchToolchain(self):
search = BToolchainSearch.BToolchainSearch()
def validateToolchains(self):
for i in range(self.pageContent.toolchainList.count()):
- filename = self.pageContent.toolchainList.item(i).text()
+ filename = qvariant_converter.getString(self.pageContent.toolchainList.item(i).data(Qt.UserRole))
self._validationProcess = QProcess()
self._validationProcess.start(filename, ["-v"])
- self._validationProcess.waitForStarted(10)
- if self._validationProcess.waitForFinished(20):
+ self._validationProcess.waitForStarted(1000)
+ if self._validationProcess.waitForFinished(200):
description = str(self._validationProcess.readAllStandardError())
infos = bertos_utils.getToolchainInfo(description)
if len(infos.keys()) == 4:
def isComplete(self):
if self.pageContent.toolchainList.currentRow() != -1:
- self._projectInfoStore("TOOLCHAIN", self.pageContent.toolchainList.item(self.pageContent.toolchainList.currentRow()).data(Qt.UserRole).toString())
+ self._projectInfoStore("TOOLCHAIN",
+ qvariant_converter.getString(self.pageContent.toolchainList.item(self.pageContent.toolchainList.currentRow()).data(Qt.UserRole)))
return True
else:
return False
\ No newline at end of file