self.pageContent.doSearchButton.setEnabled(False)
def _populateToolchainList(self):
- toolchains = qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+ toolchains = self.toolchains()
for element in toolchains:
item = QListWidgetItem(element)
item.setData(Qt.UserRole, QVariant(element))
self.emit(SIGNAL("completeChanged()"))
def _search(self):
- dirList = qvariant_converter.getStringList(self._settingsRetrieve("search_dir_list"))
- if(qvariant_converter.getBool(self._settingsRetrieve("path_search"))):
+ dirList = self.searchDirList()
+ if(self.pathSearch()):
dirList += [element for element in bertos_utils.getSystemPath()]
toolchainList = bertos_utils.findToolchains(dirList)
- storedToolchainList = qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+ 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)
item = QListWidgetItem(sel_toolchain)
item.setData(Qt.UserRole, QVariant(sel_toolchain))
self.pageContent.toolchainList.addItem(item)
- toolchains = qvariant_convert.getStringList(self._settingsRetrieve("toolchains"))
+ toolchains = self.toolchains()
toolchains = set(toolchains + [sel_toolchain])
- self._settingsStore("toolchains", list(toolchains))
+ self.setToolchains(list(toolchains))
def removeToolchain(self):
if self.pageContent.toolchainList.currentRow() != -1:
item = self.pageContent.toolchainList.takeItem(self.pageContent.toolchainList.currentRow())
toolchain = qvariant_converter.getString(item.data(Qt.UserRole))
- toolchains = qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+ toolchains = self.toolchains()
toolchains.remove(toolchain)
- self._settingsStore("toolchains", toolchains)
+ self.setToolchains(toolchains)
def searchToolchain(self):
search = BToolchainSearch.BToolchainSearch()
self.pageContent.versionList.setCurrentRow(-1)
def _storeVersion(self, directory):
- versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
+ versions = self.versions()
versions = set(versions + [directory])
- self._settingsStore("versions", list(versions))
+ self.setVersions(list(versions))
def _deleteVersion(self, directory):
- versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
+ versions = self.versions()
versions.remove(directory)
- self._settingsStore("versions", versions)
+ self.setVersions(versions)
def _insertListElement(self, directory):
if bertos_utils.isBertosDir(directory):
self.pageContent.versionList.addItem(item)
def _fillVersionList(self):
- versions = qvariant_converter.getStringList(self._settingsRetrieve("versions"))
+ versions = self.versions()
for directory in versions:
self._insertListElement(directory)
from PyQt4.QtGui import *
from PyQt4 import uic
+import qvariant_converter
+
class BWizardPage(QWizardPage):
def __init__(self, wizardGui, parent = None):
self.setLayout(layout)
def _settingsStore(self, key, value):
- QApplication.instance().settings.setValue(QString(key), QVariant(value))
+ QApplication.instance().settings.setValue(QString(key), value)
def _settingsRetrieve(self, key):
return QApplication.instance().settings.value(QString(key), QVariant())
def _projectInfoRetrieve(self, key):
return QApplication.instance().project.info(key)
+
+ def versions(self):
+ return qvariant_converter.getStringList(self._settingsRetrieve("versions"))
+
+ def setVersions(self, versions):
+ self._settingsStore("versions", qvariant_converter.convertStringList(versions))
+
+ def searchDirList(self):
+ return qvariant_converter.getStringList(self._settingsRetrieve("search_dir_list"))
+
+ def setSearchDirList(self, search_dir_list):
+ self._settingsStore("search_dir_list", qvariant_converter.convertStringList(search_dir_list))
+
+ def pathSearch(self):
+ return qvariant_converter.getBool(self._settingsRetrieve("path_search"))
+
+ def setPathSearch(self, path_search):
+ self._settingsStore("path_search", qvariant_converter.convertBool(path_search))
+
+ def toolchains(self):
+ return qvariant_converter.getStringList(self._settingsRetrieve("toolchains"))
+
+ def setToolchains(self, toolchains):
+ self._settingsStore("toolchains", qvariant_converter.convertStringList(toolchains))
def reloadData(self):
pass
\ No newline at end of file
def convertStringDict(string_dict):
result_dict = {}
for key, value in string_dict.items():
- result_dict[QString(key)] = QVariant(value)
+ result_dict[QString(key)] = QString(value)
return QVariant(result_dict)
def getBool(qvariant):
result_dict = {}
for key, value in dict_str_variant.items():
result_dict[QString(key)] = QVariant(value)
- return result_dict
\ No newline at end of file
+ return QVariant(result_dict)
\ No newline at end of file