Eliminate the explicit conversion, use instead the qvariant conversion module
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 9 Jan 2009 10:02:02 +0000 (10:02 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 9 Jan 2009 10:02:02 +0000 (10:02 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2146 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/BToolchainPage.py
wizard/BVersionPage.py

index 0787bc344b545bbbfe8db2771adcf40fce579508..6494e34d89710fa547bb2f6f94c8308f9dca76fc 100644 (file)
@@ -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):
index 2afcf1be1e94b48c0f2e16a5dbbbf9d2a77ab69a..9859355c50d16e26cac455dc875ff546c84bce5c 100644 (file)
@@ -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])
index e9ebb54b30918561d3123fb19053180ddf29edb6..2f5a62605b9c3b833611964d91316b4d743e6709 100644 (file)
@@ -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):