From 3650787f38f0edaf49ae1980b5373e43c8e1a4c6 Mon Sep 17 00:00:00 2001 From: duplo Date: Fri, 9 Jan 2009 10:02:02 +0000 Subject: [PATCH] Eliminate the explicit conversion, use instead the qvariant conversion module git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2146 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 4 +--- wizard/BToolchainPage.py | 6 +++--- wizard/BVersionPage.py | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index 0787bc34..6494e34d 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -28,9 +28,7 @@ class BCpuPage(BWizardPage): infos = bertos_utils.loadCpuInfos(self._projectInfoRetrieve("SOURCES_PATH")) for cpu in infos: 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(cpu)) + item.setData(Qt.UserRole, qvariant_converter.convertDict(cpu)) self.pageContent.cpuList.addItem(item) def _connectSignals(self): diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index 2afcf1be..9859355c 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -39,7 +39,7 @@ class BToolchainPage(BWizardPage): toolchains = self.toolchains() for element in toolchains: item = QListWidgetItem(element) - item.setData(Qt.UserRole, QVariant(element)) + item.setData(Qt.UserRole, qvariant_converter.convertString(element)) self.pageContent.toolchainList.addItem(item) def _clearList(self): @@ -57,7 +57,7 @@ class BToolchainPage(BWizardPage): toolchainList = set(toolchainList) - set(storedToolchainList) for element in toolchainList: item = QListWidgetItem(element) - item.setData(Qt.UserRole, QVariant(element)) + item.setData(Qt.UserRole, qvariant_converter.convertString(element)) self.pageContent.toolchainList.addItem(item) self.setToolchains(list(toolchainList.union(storedToolchainList))) @@ -85,7 +85,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(sel_toolchain)) + item.setData(Qt.UserRole, qvariant_converter.convertString(sel_toolchain)) self.pageContent.toolchainList.addItem(item) toolchains = self.toolchains() toolchains = set(toolchains + [sel_toolchain]) diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index e9ebb54b..2f5a6260 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -46,11 +46,11 @@ class BVersionPage(BWizardPage): def _insertListElement(self, directory): if bertos_utils.isBertosDir(directory): item = QListWidgetItem(QIcon(":/images/ok.png"), bertos_utils.bertosVersion(directory) + " (\"" + directory + "\")") - item.setData(Qt.UserRole, QVariant(directory)) + item.setData(Qt.UserRole, qvariant_converter.convertString(directory)) self.pageContent.versionList.addItem(item) elif len(directory) > 0: item = QListWidgetItem(QIcon(":/images/warning.png"), "UNKNOWN" + " (\"" + directory + "\")") - item.setData(Qt.UserRole, QVariant(directory)) + item.setData(Qt.UserRole, qvariant_converter.convertString(directory)) self.pageContent.versionList.addItem(item) def _fillVersionList(self): -- 2.25.1