#!/usr/bin/env python
# encoding: utf-8
#
-# This file is part of slimqc.
+# This file is part of bertos.
#
# Bertos is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
from BCpuPage import BCpuPage
from BOutputPage import BOutputPage
+from BRoutePage import BRoutePage
import const
import qvariant_converter
"""
Overload of the QWizardPage isComplete method.
"""
- return self.pageContent.boardList.currentItem() is not None
+ return False
def nextId(self):
"""
Overload of the QWizardPage nextId method.
"""
- # Stub of nextId logic
- if self.advanced:
- self.setProjectInfo("PRESET_ADVANCED_CONFIG", True)
- return self.wizard().pageIndex(BCpuPage)
- # Search for suitable toolchains. If there isn't one return
- # BToolchainPage id (BToolchainPage should then route to BOutputPage
- # instead of BModulePage).
-
- # If a suitable toolchain is found the user has to be prompted
- # directly to the BOutputPage
- else:
- return self.wizard().pageIndex(BOutputPage)
+ return self.wizard().pageIndex(BRoutePage)
####
"""
Overload of the BWizardPage connectSignals method.
"""
- self.connect(self.pageContent.boardList, SIGNAL('itemSelectionChanged()'), self.itemSelectionChanged)
+ pass
def reloadData(self):
"""
Overload of the BWizardPage reloadData method.
"""
- presets = presetList("/Users/duplo/Development/bertos")
- self.setProjectInfo("PRESETS", presets)
- self.populatePresetList()
-
- def populatePresetList(self):
- self.pageContent.boardList.clear()
- presets = self.projectInfo("PRESETS")
- for preset, info in presets.items():
- board_list = self.pageContent.boardList
- item = QListWidgetItem(info["PRESET_NAME"], board_list)
- item.setData(Qt.UserRole, qvariant_converter.convertString(preset))
- if self._last_selected == preset:
- self.pageContent.boardList.setCurrentItem(item)
- if not self._last_selected and self.pageContent.boardList.count():
- self.pageContent.boardList.setCurrentRow(0)
+ pass
####
## Slots ##
- def itemSelectionChanged(self):
- preset_path = qvariant_converter.getString(self.pageContent.boardList.currentItem().data(Qt.UserRole))
- presets = self.projectInfo("PRESETS")
- selected_preset = presets[preset_path]
- text_components = [
- "Board: %s" %selected_preset["PRESET_NAME"],
- "CPU: %s" %selected_preset["CPU_NAME"],
- ]
- if selected_preset["PRESET_DESCRIPTION"]:
- text_components.append("Description: %s" %selected_preset["PRESET_DESCRIPTION"])
- text = "\n".join(text_components)
- self.pageContent.descriptionLabel.setText(text)
- self._last_selected = preset_path
- self.emit(SIGNAL("completeChanged()"))
####
- @property
- def advanced(self):
- return self.pageContent.advancedCheckBox.isChecked()
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# This file is part of bertos.
+#
+# 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 BCpuPage import BCpuPage
+from BOutputPage import BOutputPage
+
+import const
+import qvariant_converter
+from bertos_utils import presetList
+
+class BRoutePage(BWizardPage):
+ """
+ Let the user choice Advanced or base route.
+ """
+
+ def __init__(self):
+ BWizardPage.__init__(self, const.UI_LOCATION + "/route_select.ui")
+ self.setTitle(self.tr("Select Advanced or Base setup"))
+ self._last_selected = None
+
+ ## Overloaded QWizardPage methods ##
+
+ def isComplete(self):
+ """
+ Overload of the QWizardPage isComplete method.
+ """
+ return False
+
+ def nextId(self):
+ """
+ Overload of the QWizardPage nextId method.
+ """
+ # Route to Toolchain page if the user select advanced
+ # or to Output page if the user select base
+ return self.wizard().pageIndex(BToolchainPage)
+
+ ####
+
+ ## Overloaded BWizardPage methods ##
+
+ def setupUi(self):
+ """
+ Overload of the BWizardPage setupUi method.
+ """
+ pass
+
+ def connectSignals(self):
+ """
+ Overload of the BWizardPage connectSignals method.
+ """
+ pass
+
+ def reloadData(self):
+ """
+ Overload of the BWizardPage reloadData method.
+ """
+ pass
+
+ ####
+
+ ## Slots ##
+
+
+ ####
+
+ @property
+ def advanced(self):
+ return self.pageContent.advancedButton.isChecked()
"""
Adds the pages in the wizard.
"""
- self._page_list = page_list
- for i, page in enumerate(self._page_list):
+ self._page_dict = {}
+ for i, page in enumerate(page_list):
+ self._page_dict[page] = i
self.setPage(i, page())
def pageIndex(self, page_class):
- return self._page_list.index(page_class)
+ return self._page_dict[page_class]
def connectSignals(self):
"""
from BIntroPage import BIntroPage
from BFolderPage import BFolderPage
from BBoardPage import BBoardPage
+from BRoutePage import BRoutePage
from BOpenPage import BOpenPage
from BVersionPage import BVersionPage
from BCpuPage import BCpuPage
def newProject():
QApplication.instance().project = BProject()
- page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage]
+ page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage]
wizard = BWizard(page_list)
wizard.show()
wizard.exec_()
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QListWidget" name="boardList">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>170</width>
- <height>0</height>
- </size>
- </property>
+ <widget class="QTreeWidget" name="boardTree">
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
</widget>
</item>
<item>
--- /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">
+ <item>
+ <widget class="QRadioButton" name="baseButton">
+ <property name="text">
+ <string>Base</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="advancedButton">
+ <property name="text">
+ <string>Advanced</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="advancedGroupBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Advanced options</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="emptyCheckBox">
+ <property name="text">
+ <string>Empty main.c</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>