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
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)
####
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):
"""
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):
--- /dev/null
+#!/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 <duplo@develer.com>
+#
+
+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
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)
####
import BFolderPage
import BVersionPage
+import BTypePage
import BCpuPage
import BToolchainPage
import BModulePage
from BIntroPage import BIntroPage
from BFolderPage import BFolderPage
+from BTypePage import BTypePage
from BBoardPage import BBoardPage
from BRoutePage import BRoutePage
from BOpenPage import BOpenPage
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_()
</property>
</widget>
</item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Board type</string>
- </property>
- <property name="checkable">
- <bool>false</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QRadioButton" name="customButton">
- <property name="text">
- <string>Custom board</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="predefinedButton">
- <property name="text">
- <string>Predefined board</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
</layout>
</widget>
<resources>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Project type</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="predefinedButton">
+ <property name="text">
+ <string>Predefined board</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="customButton">
+ <property name="text">
+ <string>Custom board</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>