from BWizardPage import *
import bertos_utils
+import qvariant_converter
class BCpuPage(BWizardPage):
def isComplete(self):
if self.pageContent.cpuList.currentRow() != -1:
- self._projectInfoStore("CPU_INFOS", self.pageContent.cpuList.currentItem().data(Qt.UserRole).toMap())
+ self._projectInfoStore("CPU_INFOS", qvariant_converter.getStringDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole)))
return True
else:
return False
def rowChanged(self):
- description = self.pageContent.cpuList.currentItem().data(Qt.UserRole).toMap()
- # I don't like to use QString as key in the dict, but the QVariant.toMap() return a dict<QString,QVariant>
- description = description[QString("CPU_DESC")].toStringList()
- # We need to convert the list of QString in a list of unicode
- description = [unicode(line) for line in description]
+ description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"]
+ description = qvariant_converter.getStringList(description)
self.pageContent.descriptionLabel.setText("<br>".join(description))
self.pageContent.descriptionLabel.setVisible(True)
self.emit(SIGNAL("completeChanged()"))
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 = qvariant_converter.getStringList(self._settingsRetrieve("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 = qvariant_converter.getStringList(self._settingsRetrieve("search_dir_list"))
+ if(qvariant_converter.getBool(self._settingsRetrieve("path_search"))):
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 = qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+ toolchainList = set(toolchainList) - set(storedToolchainList)
for element in toolchainList:
item = QListWidgetItem(element)
item.setData(Qt.UserRole, QVariant(element))
def _validItem(self, index, infos):
item = self.pageContent.toolchainList.item(index)
needed = self._projectInfoRetrieve("CPU_INFOS")
- if infos["target"].find(unicode(needed[QString("TOOLCHAIN")].toString())) != -1:
+ if infos["target"].find(needed["TOOLCHAIN"]) != -1:
item.setIcon(QIcon(":/images/ok.png"))
else:
item.setIcon(QIcon(":/images/warning.png"))
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])
+ toolchains = qvariant_convert.getStringList(self._settingsRetrieve("toolchains"))
+ toolchains = set(toolchains + [sel_toolchain])
self._settingsStore("toolchains", 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))
+ toolchain = qvariant_converter.getString(item.data(Qt.UserRole))
+ toolchains = qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+ toolchains.remove(toolchain)
self._settingsStore("toolchains", toolchains)
def searchToolchain(self):
def validateToolchains(self):
for i in range(self.pageContent.toolchainList.count()):
- filename = unicode(self.pageContent.toolchainList.item(i).data(Qt.UserRole).toString())
+ filename = qvariant_converter.getString(self.pageContent.toolchainList.item(i).data(Qt.UserRole))
self._validationProcess = QProcess()
self._validationProcess.start(filename, ["-v"])
self._validationProcess.waitForStarted(1000)
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
from PyQt4.QtGui import *
import PyQt4.uic as uic
+import qvariant_converter
+
class BToolchainSearch(QDialog):
def __init__(self):
self.content.searchButton.setEnabled(self.content.pathBox.isChecked() or self.content.customDirList.count() != 0)
def _populateDirList(self):
- search_dir_list = QApplication.instance().settings.value(QString("search_dir_list")).toList()
+ search_dir_list = qvariant_converter.getStringList(QApplication.instance().settings.value("search_dir_list"))
for element in search_dir_list:
- item = QListWidgetItem(unicode(element.toString()))
+ item = QListWidgetItem(element)
self.content.customDirList.addItem(item)
def _setPathSearch(self):
- pathSearch = QApplication.instance().settings.value(QString("path_search")).toBool()
+ pathSearch = qvariant_converter.getBool(QApplication.instance().settings.value(QString("path_search")))
self.content.pathBox.setChecked(pathSearch)
def _stateChanged(self, state):
def _addDir(self):
directory = QFileDialog.getExistingDirectory(self, self.tr("Open Directory"), "", QFileDialog.ShowDirsOnly)
if not directory.isEmpty():
+ directory = unicode(directory)
item = QListWidgetItem(directory)
self.content.customDirList.addItem(item)
- search_dir_list = QApplication.instance().settings.value(QString("search_dir_list")).toList()
- search_dir_list = set([d.toString() for d in search_dir_list] + [directory])
+ search_dir_list = qvariant_conveter.getStringList(QApplication.instance().settings.value("search_dir_list"))
+ search_dir_list = set(search_dir_list + [directory])
QApplication.instance().settings.setValue(QString("search_dir_list"), QVariant(list(search_dir_list)))
self._setSearchButton()
def _removeDir(self):
if self.content.customDirList.currentRow() != -1:
item = self.content.customDirList.takeItem(self.content.customDirList.currentRow())
- search_dir_list = QApplication.instance().settings.value(QString("search_dir_list")).toList()
- search_dir_list = set([d.toString() for d in search_dir_list])
+ search_dir_list = qvariant_converter.getStringList(QApplication.instance().settings.value(QString("search_dir_list")))
+ search_dir_list = set(search_dir_list)
search_dir_list.remove(item.text())
QApplication.instance().settings.setValue(QString("search_dir_list"), QVariant(list(search_dir_list)))
self._setSearchButton()
from PyQt4.QtGui import *
from BWizardPage import *
import bertos_utils
+import qvariant_converter
class BVersionPage(BWizardPage):
self.pageContent.versionList.setCurrentRow(-1)
def _storeVersion(self, directory):
- versions = self._settingsRetrieve("versions").toList()
- versions = set([x.toString() for x in versions] + [directory])
+ versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
+ versions = set(versions + [directory])
self._settingsStore("versions", list(versions))
def _deleteVersion(self, directory):
- versions = self._settingsRetrieve(QString("versions")).toList()
- versions = [x.toString() for x in versions]
+ versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
versions.remove(directory)
self._settingsStore("versions", versions)
item = QListWidgetItem(QIcon(":/images/ok.png"), bertos_utils.bertosVersion(directory) + " (\"" + directory + "\")")
item.setData(Qt.UserRole, QVariant(directory))
self.pageContent.versionList.addItem(item)
- elif not directory.isEmpty():
+ elif len(directory) > 0:
item = QListWidgetItem(QIcon(":/images/warning.png"), "UNKNOWN" + " (\"" + directory + "\")")
item.setData(Qt.UserRole, QVariant(directory))
self.pageContent.versionList.addItem(item)
def _fillVersionList(self):
- versions = self._settingsRetrieve("versions").toList()
+ versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
for directory in versions:
- self._insertListElement(directory.toString())
+ self._insertListElement(directory)
def isComplete(self):
if self.pageContent.versionList.currentRow() != -1:
- self._projectInfoStore("SOURCES_PATH", unicode(self.pageContent.versionList.currentItem().data(Qt.UserRole).toString()))
+ self._projectInfoStore("SOURCES_PATH", qvariant_converter.getString(self.pageContent.versionList.currentItem().data(Qt.UserRole)))
return True
else:
return False
def addVersion(self):
directory = QFileDialog.getExistingDirectory(self, self.tr("Choose a directory"), "", QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
if not directory.isEmpty():
- self._storeVersion(directory)
+ self._storeVersion(unicode(directory))
self.pageContent.versionList.clear()
self._fillVersionList()
self.emit(SIGNAL("completeChanged()"))
def removeVersion(self):
item = self.pageContent.versionList.takeItem(self.pageContent.versionList.currentRow())
- self._deleteVersion(item.data(Qt.UserRole).toString())
+ self._deleteVersion(qvariant_converter.getString(item.data(Qt.UserRole)))
self.emit(SIGNAL("completeChanged()"))
def updateClicked(self):