From: duplo Date: Mon, 24 May 2010 09:53:26 +0000 (+0000) Subject: Remove custom/predefined choice from the folder page and add a new page. X-Git-Tag: 2.5.0~123 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=c5e8d9f38c306b38703845124dc9c26fc13f8755;p=bertos.git Remove custom/predefined choice from the folder page and add a new page. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3794 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BFolderPage.py b/wizard/BFolderPage.py index 50cb2cd6..9944677c 100644 --- a/wizard/BFolderPage.py +++ b/wizard/BFolderPage.py @@ -67,8 +67,6 @@ class BFolderPage(BWizardPage): self.setProjectInfo("PROJECT_NAME", os.path.basename(unicode(self.pageContent.projectPath.text()))) self.setProjectInfo("PROJECT_SRC_PATH", os.path.join(self.projectInfo("PROJECT_PATH"), self.projectInfo("PROJECT_NAME"))) self.setProjectInfo("PROJECT_HW_PATH", os.path.join(self.projectInfo("PROJECT_PATH"), self.projectInfo("PROJECT_NAME"))) - self.setProjectInfo("ROUTE", self.next_page) - self.setProjectInfo("PROJECT_FROM_PRESET", self.from_preset) return True else: return False @@ -90,7 +88,7 @@ class BFolderPage(BWizardPage): self.connect(self.pageContent.nameEdit, SIGNAL("textChanged(const QString)"), self.nameChanged) self.connect(self.pageContent.directoryEdit, SIGNAL("textChanged(const QString)"), self.directoryChanged) self.connect(self.pageContent.directoryButton, SIGNAL("clicked()"), self.selectDirectory) - self.connect(self.pageContent.customButton, SIGNAL("toggled(bool)"), self.isComplete) + # self.connect(self.pageContent.customButton, SIGNAL("toggled(bool)"), self.isComplete) #### @@ -129,20 +127,6 @@ class BFolderPage(BWizardPage): self.pageContent.directoryEdit.setText(QDir.toNativeSeparators(directory)) #### - - @property - def next_page(self): - """ - Contains the next page class. - """ - if self.from_preset: - return BBoardPage - else: - return BCpuPage - - @property - def from_preset(self): - return self.pageContent.predefinedButton.isChecked() def initializeAttributes(self): """ diff --git a/wizard/BProject.py b/wizard/BProject.py index b31c3f11..c2f6613a 100644 --- a/wizard/BProject.py +++ b/wizard/BProject.py @@ -226,7 +226,10 @@ class BProject(object): def _loadPresetInfo(self, preset_spec_file): D = {} - execfile(preset_spec_file, {}, D) + try: + execfile(preset_spec_file, {}, D) + except IOError, e: + pass return D def loadModuleData(self, edit=False): diff --git a/wizard/BTypePage.py b/wizard/BTypePage.py new file mode 100644 index 00000000..0968156f --- /dev/null +++ b/wizard/BTypePage.py @@ -0,0 +1,85 @@ +#!/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/BVersionPage.py b/wizard/BVersionPage.py index 680577c5..23f6fb01 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -69,14 +69,6 @@ class BVersionPage(BWizardPage): return True else: return False - - def nextId(self): - """ - Overload of the QWizard nextId method. - """ - # Pick up the class stored into the project in the 'folder' step - page_class = self.projectInfo("ROUTE") - return self.wizard().pageIndex(page_class) #### diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 4b7ab45d..55f913d6 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -40,6 +40,7 @@ from PyQt4.QtGui import * import BFolderPage import BVersionPage +import BTypePage import BCpuPage import BToolchainPage import BModulePage diff --git a/wizard/bertos.py b/wizard/bertos.py index f04c16f6..65e578cc 100755 --- a/wizard/bertos.py +++ b/wizard/bertos.py @@ -48,6 +48,7 @@ from BWizard import BWizard from BIntroPage import BIntroPage from BFolderPage import BFolderPage +from BTypePage import BTypePage from BBoardPage import BBoardPage from BRoutePage import BRoutePage from BOpenPage import BOpenPage @@ -67,7 +68,7 @@ from LoadException import VersionException, ToolchainException def newProject(): QApplication.instance().project = BProject() - page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] + page_list = [BIntroPage, BFolderPage, BVersionPage, BTypePage, BBoardPage, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] wizard = BWizard(page_list) wizard.show() wizard.exec_() diff --git a/wizard/ui/dir_select.ui b/wizard/ui/dir_select.ui index a0f2d5bd..6e60aab9 100644 --- a/wizard/ui/dir_select.ui +++ b/wizard/ui/dir_select.ui @@ -142,35 +142,6 @@ - - - - Board type - - - false - - - - - - Custom board - - - true - - - - - - - Predefined board - - - - - - diff --git a/wizard/ui/project_type_select.ui b/wizard/ui/project_type_select.ui new file mode 100644 index 00000000..be438c28 --- /dev/null +++ b/wizard/ui/project_type_select.ui @@ -0,0 +1,47 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Project type + + + + + + Predefined board + + + true + + + + + + + Custom board + + + + + + + + + + +