From 5250557e876e7e2b81eafcc1fb3d7ed0abc5616c Mon Sep 17 00:00:00 2001 From: duplo Date: Thu, 23 Jul 2009 13:42:28 +0000 Subject: [PATCH] Add menu in order to configure toolchain git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2763 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BEditingDialog.py | 57 ++++++++++++++++++++++++++++++++++++++++ wizard/bertos_utils.py | 1 + 2 files changed, 58 insertions(+) diff --git a/wizard/BEditingDialog.py b/wizard/BEditingDialog.py index 82bac4ed..6c714a50 100644 --- a/wizard/BEditingDialog.py +++ b/wizard/BEditingDialog.py @@ -53,8 +53,64 @@ class BEditingDialog(QDialog): layout = QVBoxLayout() self.module_page = BModulePage.BModulePage() layout.addWidget(self.module_page) + button_layout = QHBoxLayout() + self.advanced_button = QToolButton() + self.setupMenu() + self.advanced_button.setMenu(self.menu) + self.advanced_button.setPopupMode(QToolButton.InstantPopup) + self.advanced_button.setText(self.tr("Advanced")) + button_layout.addWidget(self.advanced_button) + button_layout.addStretch() + self.cancel_button = QPushButton(self.tr("Cancel")) + button_layout.addWidget(self.cancel_button) + self.apply_button = QPushButton(self.tr("Apply")) + button_layout.addWidget(self.apply_button) + layout.addLayout(button_layout) self.setLayout(layout) + def setupMenu(self): + self.menu = QMenu(self.tr("Advanced options")) + self.setupToolchainMenu() + self.menu.addMenu(self.toolchain_menu) + self.setupVersionMenu() + self.menu.addMenu(self.version_menu) + + def setupToolchainMenu(self): + self.toolchain_menu = QMenu(self.tr("select toolchain")) + action_group = QActionGroup(self.toolchain_menu) + for toolchain in sorted(self.toolchains()): + action = self.toolchain_menu.addAction(toolchain) + action_group.addAction(action) + action.setCheckable(True) + action.setChecked(True if unicode(action.text()) == self.currentToolchain()["path"] else False) + + def setupVersionMenu(self): + self.version_menu = QMenu(self.tr("select BeRTOS version")) + action_group = QActionGroup(self.version_menu) + for version in sorted(self.versions()): + action = self.version_menu.addAction(version) + action_group.addAction(action) + action.setCheckable(True) + action.setChecked(True if unicode(action.text()) == self.currentVersion() else False) + + def toolchains(self): + return self.module_page.toolchains() + + def currentToolchain(self): + return self.module_page.projectInfo("TOOLCHAIN") + + def setCurrentToolchain(self, toolchain): + self.module_page.setProjectInfo("TOOLCHAIN", toolchain) + + def versions(self): + return self.module_page.versions() + + def currentVersion(self): + return self.module_page.projectInfo("SOURCES_PATH") + + def setCurrentVersion(self, version): + self.module_page.setProjectInfo("SOURCES_PATH", version) + def main(): @@ -65,6 +121,7 @@ def main(): sys.exit() app = QApplication([]) app.project = loadBertosProject(project_file) + app.settings = QSettings("Develer", "Bertos Configurator") dialog = BEditingDialog() dialog.show() sys.exit(app.exec_()) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 59200703..8a73185d 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -58,6 +58,7 @@ def loadBertosProject(project_file): project_info = BProject.BProject() project_info.setInfo("PROJECT_PATH", os.path.dirname(project_file)) project_info.setInfo("SOURCES_PATH", project_data["SOURCES_PATH"]) + project_info.setInfo("TOOLCHAIN", project_data["TOOLCHAIN"]) loadSourceTree(project_info) cpu_name = project_data["CPU_NAME"] project_info.setInfo("CPU_NAME", cpu_name) -- 2.25.1