X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBToolchainPage.py;h=a2929b5dc135b293c0f0e1b4adefd53b5529fdfe;hb=80a0b725c40c4b7f6981009aa6b3d1824acd19b1;hp=16cfe7c25fdbcf924c2bf8989b8b04e628179a64;hpb=e4faa12ff38fb20e13c34527410cc267a88e16dc;p=bertos.git diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index 16cfe7c2..a2929b5d 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -17,10 +17,12 @@ import BToolchainSearch import bertos_utils import qvariant_converter +from const import * + class BToolchainPage(BWizardPage): def __init__(self): - BWizardPage.__init__(self, "toolchain_select.ui") + BWizardPage.__init__(self, UI_LOCATION + "/toolchain_select.ui") self.setTitle(self.tr("Select toolchain")) self._validationProcess = None self._updateUi() @@ -43,15 +45,16 @@ class BToolchainPage(BWizardPage): self.pageContent.toolchainList.clear() def _selectionChanged(self): - infos = collections.defaultdict(lambda: unicode("not defined")) - infos.update(qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole))) - self.pageContent.infoLabel.setText("GCC " + infos["version"] + " (" + infos["build"] + ")\nTarget: " + infos["target"] + "\nPath: " + infos["path"]) - self.pageContent.infoLabel.setVisible(True) - self.emit(SIGNAL("completeChanged()")) + if self.pageContent.toolchainList.currentIndex != -1: + infos = collections.defaultdict(lambda: unicode("not defined")) + infos.update(qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole))) + self.pageContent.infoLabel.setText("GCC " + infos["version"] + " (" + infos["build"] + ")\nTarget: " + infos["target"] + "\nPath: " + os.path.normpath(infos["path"])) + self.pageContent.infoLabel.setVisible(True) + self.emit(SIGNAL("completeChanged()")) def _search(self): dirList = self.searchDirList() - if(self.pathSearch()): + if self.pathSearch(): dirList += [element for element in bertos_utils.getSystemPath()] toolchainList = bertos_utils.findToolchains(dirList) storedToolchains = self.toolchains() @@ -90,7 +93,7 @@ class BToolchainPage(BWizardPage): sel_toolchain = QFileDialog.getOpenFileName(self, self.tr("Choose the toolchain"), "") if not sel_toolchain.isEmpty(): item = QListWidgetItem(sel_toolchain) - item.setData(Qt.UserRole, qvariant_converter.convertString(sel_toolchain)) + item.setData(Qt.UserRole, qvariant_converter.convertString({"path": sel_toolchain})) self.pageContent.toolchainList.addItem(item) toolchains = self.toolchains() toolchains[sel_toolchain] = False @@ -135,7 +138,7 @@ class BToolchainPage(BWizardPage): def isComplete(self): if self.pageContent.toolchainList.currentRow() != -1: self._projectInfoStore("TOOLCHAIN", - qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole))["path"]) + qvariant_converter.getStringDict(self.pageContent.toolchainList.currentItem().data(Qt.UserRole))) return True else: return False