BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui")
self.setTitle(self.tr("Create the BeRTOS project"))
self._setupUi()
- self._connectSignals()
self._completed = False
+ self.setButtonText(QWizard.NextButton, self.tr("Create"))
def _setupUi(self):
- self._confirm_group = QWidgetGroup(self.pageContent.summaryTree,
- self.pageContent.createButton)
- self._final_group = QWidgetGroup(self.pageContent.iconLabel,
- self.pageContent.textLabel)
- self._final_group.setVisible(False)
summary = self.pageContent.summaryTree
summary.setHeaderHidden(True)
summary.setColumnCount(1)
def reloadData(self):
- self._completed = False
self._setupUi()
self.pageContent.summaryTree.clear()
top_level = []
category_item.addChildren(value)
top_level.append(module_title)
self.pageContent.summaryTree.insertTopLevelItems(0, top_level)
-
- def _connectSignals(self):
- self.connect(self.pageContent.createButton, SIGNAL("clicked(bool)"), self._createProject)
-
- def _createProject(self):
- QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
- self._confirm_group.setVisible(False)
- bertos_utils.createBertosProject(self.wizard().project())
- self._final_group.setVisible(True)
- self._completed = True
- QApplication.restoreOverrideCursor()
- self.emit(SIGNAL("completeChanged()"))
-
- def isComplete(self):
- return self._completed
-
-class QWidgetGroup(QObject):
- """
- Container class, this class contains widgets and permit to set some
- properties of the contained widgets at the same time.
- """
- def __init__(self, *elements):
- self._widgets = []
- for element in elements:
- self._widgets.append(element)
-
- def addWidget(self, widget):
- if widget not in self._widgets:
- self._widgets.append(widget)
-
- def setVisible(self, visible):
- for widget in self._widgets:
- widget.setVisible(visible)
-
- def isVisible(self):
- for widget in self._widgets:
- if not widget.isVisible():
- return False
- return True
--- /dev/null
+#!/usr/bin/env python
+# encoding: utf-8
+#
+# Copyright 2009 Develer S.r.l. (http://www.develer.com/)
+# All rights reserved.
+#
+# $Id:$
+#
+# Author: Lorenzo Berni <duplo@develer.com>
+#
+
+import os
+
+from PyQt4.QtGui import *
+
+from BWizardPage import *
+import bertos_utils
+
+from const import *
+
+class BFinalPage(BWizardPage):
+
+ def __init__(self):
+ BWizardPage.__init__(self, UI_LOCATION + "/final_page.ui")
+ self.setTitle(self.tr("Project created successfully"))
+
+ def reloadData(self):
+ QApplication.instance().setOverrideCursor(Qt.WaitCursor)
+ bertos_utils.createBertosProject(self.wizard().project())
+ QApplication.instance().restoreOverrideCursor()
\ No newline at end of file
self._connectSignals()
def reloadData(self):
+ QApplication.instance().setOverrideCursor(Qt.WaitCursor)
self._setupUi()
self._loadModuleData()
self._fillModuleTree()
+ QApplication.instance().restoreOverrideCursor()
def _setupButtonGroup(self):
self._button_group = QButtonGroup()
import BModulePage
import BOutputPage
import BCreationPage
+import BFinalPage
class BWizard(QWizard):
# TODO: choose the right minimum size
self.setMinimumSize(1000, 500)
self.setWindowTitle(self.tr("Create a BeRTOS project"))
+ self.setOption(QWizard.DisabledBackButtonOnLastPage, True)
self._addPages()
self._connectSignals()
self.addPage(BModulePage.BModulePage())
self.addPage(BOutputPage.BOutputPage())
self.addPage(BCreationPage.BCreationPage())
+ self.addPage(BFinalPage.BFinalPage())
def _connectSignals(self):
self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)
page.reloadData()
def project(self):
- return copy.deepcopy(QApplication.instance().project)
\ No newline at end of file
+ return copy.deepcopy(QApplication.instance().project)
--- /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="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="iconLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="../bertos.qrc">:/images/ok.png</pixmap>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="messageLabel">
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <property name="text">
+ <string>Project created successfully. Now start develop your BeRTOS application!</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources>
+ <include location="../bertos.qrc"/>
+ </resources>
+ <connections/>
+</ui>
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>Form</class>
- <widget class="QWidget" name="Form" >
- <property name="geometry" >
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>336</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QTreeWidget" name="summaryTree" >
+ <widget class="QTreeWidget" name="summaryTree">
<column>
- <property name="text" >
+ <property name="text">
<string>1</string>
</property>
</column>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QToolButton" name="createButton" >
- <property name="text" >
- <string>Create</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3" >
- <item>
- <widget class="QLabel" name="iconLabel" >
- <property name="text" >
- <string/>
- </property>
- <property name="pixmap" >
- <pixmap resource="../bertos.qrc" >:/images/ok.png</pixmap>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="textLabel" >
- <property name="text" >
- <string>The project has been created correctly</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</widget>
<resources>
- <include location="../bertos.qrc" />
+ <include location="../bertos.qrc"/>
</resources>
<connections/>
</ui>