+ self.connect(self.cpu_frequency_spinbox, SIGNAL("valueChanged(double)"), self.frequencyChanged)
+
+ def setFrequency(self):
+ frequency = long(self.module_page.projectInfo("SELECTED_FREQ"))
+ self.cpu_frequency_spinbox.setValue(frequency)
+
+ def frequencyChanged(self, frequency):
+ frequency = unicode(long(frequency))
+ self.module_page.setProjectInfo("SELECTED_FREQ", frequency)
+
+ def changeToolchain(self):
+ dialog = BToolchainDialog()
+ if dialog.exec_():
+ toolchain = qvariant_converter.getStringDict(dialog.toolchain_page.currentItem().data(Qt.UserRole))
+ dialog.toolchain_page.setProjectInfo("TOOLCHAIN", toolchain)
+
+ def changeBertosVersion(self):
+ current_version = self.module_page.projectInfo("BERTOS_PATH")
+ dialog = BVersionDialog()
+ if dialog.exec_():
+ version = qvariant_converter.getString(dialog.version_page.currentItem().data(Qt.UserRole))
+ if QMessageBox.question(
+ dialog.version_page,
+ self.tr("BeRTOS version update"),
+ self.tr("Changing the BeRTOS version will destroy all the modification done on the BeRTOS sources"),
+ QMessageBox.Ok | QMessageBox.Cancel
+ ) == QMessageBox.Ok:
+ try:
+ qApp.setOverrideCursor(QCursor(Qt.WaitCursor))
+ dialog.version_page.setProjectInfo("BERTOS_PATH", version)
+ dialog.version_page.setProjectInfo("OLD_BERTOS_PATH", current_version)
+ enabled_modules = bertos_utils.enabledModules(dialog.version_page.project)
+ old_configuration = dialog.version_page.projectInfo("CONFIGURATIONS")
+ dialog.version_page.project.loadSourceTree()
+ QApplication.instance().project.reloadCpuInfo()
+ QApplication.instance().project.loadModuleData()
+ new_configuration = dialog.version_page.projectInfo("CONFIGURATIONS")
+ merged_configuration = {}
+ for conf in new_configuration:
+ if conf in old_configuration:
+ configuration = bertos_utils.updateConfigurationValues(new_configuration[conf], old_configuration[conf])
+ else:
+ configuration = new_configuration[conf]
+ merged_configuration[conf] = configuration
+ dialog.version_page.setProjectInfo("CONFIGURATIONS", merged_configuration)
+ dialog.version_page.project.setEnabledModules(enabled_modules)
+ self.module_page.fillModuleTree()
+ finally:
+ qApp.restoreOverrideCursor()
+ else:
+ # Rollback version to the previous selected one.
+ dialog.version_page.setProjectInfo("BERTOS_PATH", current_version)