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 ##
"""
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)
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):
+++ /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
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:
from BIntroPage import BIntroPage
from BFolderPage import BFolderPage
-from BTypePage import BTypePage
from BBoardPage import BBoardPage
from BProjectPresets import BProjectPresets
from BRoutePage import BRoutePage
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_()
<property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0">
<item>
- <widget class="QListWidget" name="boardList">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>200</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>200</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QListWidget" name="boardList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="customButton">
+ <property name="toolTip">
+ <string><p><strong>Custom board project </strong>- select me when your board is not preset into the list above.</p></string>
+ </property>
+ <property name="text">
+ <string>Custom Board</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</item>
</layout>
</item>
<rect>
<x>0</x>
<y>0</y>
- <width>318</width>
+ <width>316</width>
<height>336</height>
</rect>
</property>
+++ /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" stretch="0,1">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <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>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>194</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>