예제 #1
0
파일: BCpuPage.py 프로젝트: insha/bertos
 def isComplete(self):
     """
     Overload of the QWizardPage isComplete method.
     """
     if self.pageContent.cpuList.currentRow() != -1:
         self.pageContent.frequencyLabel.setVisible(True)
         self.pageContent.frequencySpinBox.setVisible(True)
         infos = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))
         for key, value in infos.items():
             if key in CPU_DEF:
                 if type(CPU_DEF[key]) == list:
                     infos[key] = qvariant_converter.getStringList(value)
                 if type(CPU_DEF[key]) == str or type(CPU_DEF) == unicode:
                     infos[key] = qvariant_converter.getString(value)
             elif key.startswith(MK_PARAM_ID):
                 infos[key] = qvariant_converter.getString(value)
             else:
                 del infos[key]
         self.setProjectInfo("CPU_INFOS", infos)
         self.setProjectInfo("CPU_NAME", unicode(self.pageContent.cpuList.currentItem().text()))
         self.setProjectInfo("SELECTED_FREQ", unicode(long(self.pageContent.frequencySpinBox.value())))
         tag_dict = self.projectInfo("ALL_CPU_TAGS")
         for tag in tag_dict:
             if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["TOOLCHAIN"]]:
                 tag_dict[tag] = True
             else:
                 tag_dict[tag] = False
         self.setProjectInfo("ALL_CPU_TAGS", tag_dict)
         return True
     else:
         return False
예제 #2
0
 def updateUi(self):
     if self.selected:
         preset_path = qvariant_converter.getString(self.selected.data(Qt.UserRole))
         preset = self.preset_data["children"][preset_path]
         description = preset["info"].get("description", "")
         path = unicode(QUrl.fromLocalFile(preset_path).toString())
         description = description.replace("$path", path)
         self.pageContent.descriptionArea.setHtml(description)
예제 #3
0
    def removeVersion(self):
        """
        Slot called when the user remove a BeRTOS version.
        """
        item = self.pageContent.versionList.takeItem(self.pageContent.versionList.currentRow())
	if item:
		self.deleteVersion(qvariant_converter.getString(item.data(Qt.UserRole)))
        self.emit(SIGNAL("completeChanged()"))
예제 #4
0
 def updateUi(self):
     if self.selected:
         preset_path = qvariant_converter.getString(
             self.selected.data(Qt.UserRole))
         preset = self.preset_data["children"][preset_path]
         description = preset["info"].get("description", "")
         path = unicode(QUrl.fromLocalFile(preset_path).toString())
         description = description.replace("$path", path)
         self.pageContent.descriptionArea.setHtml(description)
예제 #5
0
 def selected_path(self):
     current_widget = self.pageContent.boardTabWidget.currentWidget()
     preset_path = None
     if current_widget:
         current_item = current_widget.pageContent.presetList.currentItem()
         if current_item:
             preset_path = current_item.data(Qt.UserRole)
             preset_path = qvariant_converter.getString(preset_path)
     return preset_path
예제 #6
0
 def selected_path(self):
     current_widget = self.pageContent.boardTabWidget.currentWidget()
     preset_path = None
     if current_widget:
         current_item = current_widget.pageContent.presetList.currentItem()
         if current_item:
             preset_path = current_item.data(Qt.UserRole)
             preset_path = qvariant_converter.getString(preset_path)
     return preset_path
예제 #7
0
 def currentVersion(self):
     """
     Return the path of the selected version.
     """
     current = self.currentItem()
     if current:
         return qvariant_converter.getString(current.data(Qt.UserRole))
     else:
         return None
예제 #8
0
 def isComplete(self):
     """
     Overload of the QWizardPage isComplete method.
     """
     if self.pageContent.versionList.currentRow() != -1:
         sources_path = qvariant_converter.getString(self.pageContent.versionList.currentItem().data(Qt.UserRole))
         # Remove the trailing slash
         if sources_path.endswith(os.sep):
             sources_path = sources_path[:-1]
         self.setProjectInfo("BERTOS_PATH", sources_path)
         return True
     else:
         return False
예제 #9
0
 def isComplete(self):
     """
     Overload of the QWizardPage isComplete method.
     """
     if self.pageContent.cpuList.currentRow() != -1:
         self.pageContent.frequencyLabel.setVisible(True)
         self.pageContent.frequencySpinBox.setVisible(True)
         infos = qvariant_converter.getDict(
             self.pageContent.cpuList.currentItem().data(Qt.UserRole))
         for key, value in infos.items():
             if key in CPU_DEF:
                 if type(CPU_DEF[key]) == list:
                     infos[key] = qvariant_converter.getStringList(value)
                 if type(CPU_DEF[key]) == str or type(CPU_DEF) == unicode:
                     infos[key] = qvariant_converter.getString(value)
             elif key.startswith(MK_PARAM_ID):
                 infos[key] = qvariant_converter.getString(value)
             else:
                 del infos[key]
         self.setProjectInfo("CPU_INFOS", infos)
         self.setProjectInfo(
             "CPU_NAME",
             unicode(self.pageContent.cpuList.currentItem().text()))
         self.setProjectInfo(
             "SELECTED_FREQ",
             unicode(long(self.pageContent.frequencySpinBox.value())))
         tag_dict = self.projectInfo("ALL_CPU_TAGS")
         for tag in tag_dict:
             if tag in infos["CPU_TAGS"] + [
                     infos["CPU_NAME"], infos["TOOLCHAIN"]
             ]:
                 tag_dict[tag] = True
             else:
                 tag_dict[tag] = False
         self.setProjectInfo("ALL_CPU_TAGS", tag_dict)
         return True
     else:
         return False
예제 #10
0
 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)
예제 #11
0
파일: BCpuPage.py 프로젝트: insha/bertos
 def rowChanged(self):
     """
     Slot called when the user select an entry from the cpu list.
     """
     if self.pageContent.cpuList.currentItem():
         description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))[
             "CPU_DESC"
         ]
         description = qvariant_converter.getStringList(description)
         if not self.freq_modified:
             # Retrieve the default cpu frequency when the value isn't already modified
             current_freq = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))[
                 "CPU_DEFAULT_FREQ"
             ]
             current_freq = qvariant_converter.getString(current_freq)
             current_freq = long(current_freq.replace("U", "").replace("L", ""))
             self.pageContent.frequencySpinBox.setValue(long(current_freq))
         self.pageContent.descriptionLabel.setText("<br>".join(description))
         self.pageContent.descriptionLabel.setVisible(True)
         self.emit(SIGNAL("completeChanged()"))
예제 #12
0
 def rowChanged(self):
     """
     Slot called when the user select an entry from the cpu list.
     """
     if self.pageContent.cpuList.currentItem():
         description = qvariant_converter.getDict(
             self.pageContent.cpuList.currentItem().data(
                 Qt.UserRole))["CPU_DESC"]
         description = qvariant_converter.getStringList(description)
         if not self.freq_modified:
             # Retrieve the default cpu frequency when the value isn't already modified
             current_freq = qvariant_converter.getDict(
                 self.pageContent.cpuList.currentItem().data(
                     Qt.UserRole))["CPU_DEFAULT_FREQ"]
             current_freq = qvariant_converter.getString(current_freq)
             current_freq = long(
                 current_freq.replace("U", "").replace("L", ""))
             self.pageContent.frequencySpinBox.setValue(long(current_freq))
         self.pageContent.descriptionLabel.setText("<br>".join(description))
         self.pageContent.descriptionLabel.setVisible(True)
         self.emit(SIGNAL("completeChanged()"))
예제 #13
0
    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)
예제 #14
0
 def defaultFolder(self):
     """
     Returns the default save folder stored in the QSettings.
     """
     return qvariant_converter.getString(self.settingsRetrieve("folder"))
예제 #15
0
 def defaultFolder(self):
     """
     Returns the default save folder stored in the QSettings.
     """
     return qvariant_converter.getString(self.settingsRetrieve("folder"))