From 8f2036c05d9a8531400c1ab97dca9193e92187d3 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 26 May 2010 14:16:12 +0000 Subject: [PATCH] Remove the base/advance choice page. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3841 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BBoardPage.py | 14 +++++ wizard/BTypePage.py | 85 ------------------------------ wizard/BWizard.py | 10 ---- wizard/bertos.py | 3 +- wizard/ui/board_select.ui | 90 ++++++++++++++++++++++++-------- wizard/ui/project_type_select.ui | 60 --------------------- 6 files changed, 82 insertions(+), 180 deletions(-) delete mode 100644 wizard/BTypePage.py delete mode 100644 wizard/ui/project_type_select.ui diff --git a/wizard/BBoardPage.py b/wizard/BBoardPage.py index 301d46b7..6d7fc89b 100644 --- a/wizard/BBoardPage.py +++ b/wizard/BBoardPage.py @@ -69,10 +69,18 @@ class BBoardPage(BWizardPage): preset_path = qvariant_converter.getStringDict(preset_path["info"]) preset_path = preset_path["path"] self.setProjectInfo("PROJECT_BOARD", preset_path) + self.setProjectInfo("PROJECT_FROM_PRESET", True) return True else: return False + def nextId(self): + wizard = self.wizard() + if not self.projectInfo("PROJECT_FROM_PRESET"): + return wizard.pageIndex(BCpuPage) + else: + return QWizardPage.nextId(self) + #### ## Overloaded BWizardPage methods ## @@ -89,11 +97,13 @@ class BBoardPage(BWizardPage): """ self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self.updateUi) self.connect(self.pageContent.boardList, SIGNAL("itemSelectionChanged()"), self, SIGNAL("completeChanged()")) + self.connect(self.pageContent.customButton, SIGNAL("clicked()"), self.customButtonClicked) def reloadData(self): """ Overload of the BWizardPage reloadData method. """ + self.project.loadProjectPresets() preset_list = self.projectInfo("PRESET_TREE") preset_list = preset_list["children"] preset_list = sorted(preset_list.values(), _cmp) @@ -116,6 +126,10 @@ class BBoardPage(BWizardPage): self.pageContent.imageLabel.setVisible(False) self.pageContent.descriptionLabel.setText(description) + def customButtonClicked(self): + self.setProjectInfo("PROJECT_FROM_PRESET", False) + self.wizard().next() + #### def setItems(self, preset_list): diff --git a/wizard/BTypePage.py b/wizard/BTypePage.py deleted file mode 100644 index 0968156f..00000000 --- a/wizard/BTypePage.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -# -# This file is part of slimqc. -# -# Bertos is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# -# As a special exception, you may use this file as part of a free software -# library without restriction. Specifically, if other files instantiate -# templates or use macros or inline functions from this file, or you compile -# this file and link it with other files to produce an executable, this -# file does not by itself cause the resulting executable to be covered by -# the GNU General Public License. This exception does not however -# invalidate any other reasons why the executable file might be covered by -# the GNU General Public License. -# -# Copyright 2010 Develer S.r.l. (http://www.develer.com/) -# -# $Id$ -# -# Author: Lorenzo Berni -# - -from PyQt4.QtCore import * -from PyQt4.QtGui import * - -from BWizardPage import BWizardPage - -from BBoardPage import BBoardPage -from BCpuPage import BCpuPage - -from const import UI_LOCATION - -class BTypePage(BWizardPage): - def __init__(self): - BWizardPage.__init__(self, UI_LOCATION + "/project_type_select.ui") - self.setTitle(self.tr("Select the project type")) - - ## Overloaded QWizardPage methods ## - - def isComplete(self): - self.setProjectInfo("PROJECT_FROM_PRESET", self.from_preset) - return True - - def nextId(self): - if self.from_preset: - return self.wizard().pageIndex(BBoardPage) - else: - return self.wizard().pageIndex(BCpuPage) - - #### - - ## Overloaded BWizardPage methods ## - - def connectSignals(self): - self.connect(self.pageContent.predefinedButton, SIGNAL("toggled(bool)"), self, SIGNAL("completeChanged()")) - - def reloadData(self): - self.project.loadProjectPresets() - self.pageContent.predefinedButton.setEnabled(len(self.has_presets) > 0) - self.pageContent.predefinedButton.setChecked(len(self.has_presets) > 0) - self.pageContent.customButton.setChecked(len(self.has_presets) == 0) - - #### - - @property - def from_preset(self): - return self.pageContent.predefinedButton.isChecked() - - @property - def has_presets(self): - preset_tree = self.project.info("PRESET_TREE") - return isinstance(preset_tree, dict) and preset_tree.get("children", []) \ No newline at end of file diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 56d37943..4fd56035 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -38,16 +38,6 @@ import copy from PyQt4.QtCore import * from PyQt4.QtGui import * -import BFolderPage -import BVersionPage -import BTypePage -import BCpuPage -import BToolchainPage -import BModulePage -import BOutputPage -import BCreationPage -import BFinalPage - try: from version import wizard_version except ImportError: diff --git a/wizard/bertos.py b/wizard/bertos.py index abee435b..5576ab27 100755 --- a/wizard/bertos.py +++ b/wizard/bertos.py @@ -48,7 +48,6 @@ from BWizard import BWizard from BIntroPage import BIntroPage from BFolderPage import BFolderPage -from BTypePage import BTypePage from BBoardPage import BBoardPage from BProjectPresets import BProjectPresets from BRoutePage import BRoutePage @@ -69,7 +68,7 @@ from LoadException import VersionException, ToolchainException def newProject(): QApplication.instance().project = BProject() - page_list = [BIntroPage, BFolderPage, BVersionPage, BTypePage, BBoardPage, BProjectPresets, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] + page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BProjectPresets, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] wizard = BWizard(page_list) wizard.show() wizard.exec_() diff --git a/wizard/ui/board_select.ui b/wizard/ui/board_select.ui index 0b59a125..6731a70e 100644 --- a/wizard/ui/board_select.ui +++ b/wizard/ui/board_select.ui @@ -13,30 +13,74 @@ Form - + - + - - - - 0 - 0 - - - - - 200 - 0 - - - - - 200 - 16777215 - - - + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + + + + <p><strong>Custom board project </strong>- select me when your board is not preset into the list above.</p> + + + Custom Board + + + + + + + Qt::Horizontal + + + + 20 + 20 + + + + + @@ -50,7 +94,7 @@ 0 0 - 318 + 316 336 diff --git a/wizard/ui/project_type_select.ui b/wizard/ui/project_type_select.ui deleted file mode 100644 index 67c27beb..00000000 --- a/wizard/ui/project_type_select.ui +++ /dev/null @@ -1,60 +0,0 @@ - - - Form - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - - - Predefined board - - - true - - - - - - - Custom board - - - - - - - - - - Qt::Vertical - - - - 20 - 194 - - - - - - - - - -- 2.25.1