+ """
+ Slot called when the user clicks on the 'update' button. It checks for
+ update (TO BE IMPLEMENTED).
+ """
+ pass
+
+ ####
+
+ def storeVersion(self, directory):
+ """
+ Stores the directory selected by the user in the QSettings.
+ """
+ versions = self.versions()
+ versions = set(versions + [directory])
+ self.setVersions(list(versions))
+
+ def deleteVersion(self, directory):
+ """
+ Removes the given directory from the QSettings.
+ """
+ versions = [os.path.normpath(path) for path in self.versions()]
+ versions.remove(os.path.normpath(directory))
+ self.setVersions(versions)
+
+ def resetVersionList(self):
+ """
+ Remove all the version entries from the list.
+ """
+ self.pageContent.versionList.clear()
+
+ def insertListElement(self, directory):
+ """
+ Inserts the given directory in the version list and returns the
+ inserted item.
+ """
+ if bertos_utils.isBertosDir(directory):
+ item = QListWidgetItem(QIcon(":/images/ok.png"), bertos_utils.bertosVersion(directory) + " (\"" + os.path.normpath(directory) + "\")")
+ item.setData(Qt.UserRole, qvariant_converter.convertString(directory))
+ self.pageContent.versionList.addItem(item)
+ return item
+ elif len(directory) > 0:
+ item = QListWidgetItem(QIcon(":/images/warning.png"), "UNKNOWN" + " (\"" + os.path.normpath(directory) + "\")")
+ item.setData(Qt.UserRole, qvariant_converter.convertString(directory))
+ self.pageContent.versionList.addItem(item)
+ return item
+
+ def fillVersionList(self):
+ """
+ Fills the version list with all the BeRTOS versions founded in the QSettings.
+ """
+ versions = set([])
+ if os.name == "nt":
+ import winreg_importer
+ versions |= set([os.path.normpath(dir) for dir in winreg_importer.getBertosDirs()])
+ versions |= set([os.path.normpath(dir) for dir in self.versions()])
+ selected = self.projectInfo("BERTOS_PATH")
+ for directory in versions:
+ item = self.insertListElement(directory)
+ if selected and selected == directory:
+ self.setCurrentItem(item)
+ if not selected:
+ latest_version_item = self.latestVersionItem()
+ if latest_version_item:
+ self.setCurrentItem(latest_version_item)