Add a final page after the project creation
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 31 Mar 2009 09:00:34 +0000 (09:00 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 31 Mar 2009 09:00:34 +0000 (09:00 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2443 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCreationPage.py
wizard/BFinalPage.py [new file with mode: 0644]
wizard/BModulePage.py
wizard/BWizard.py
wizard/ui/final_page.ui [new file with mode: 0644]
wizard/ui/project_creation.ui

index 892f9e8241573d866923754292e7c99a3894fe07..8b2158f394de634396e5e54639d04df4fcb6974f 100644 (file)
@@ -24,21 +24,15 @@ class BCreationPage(BWizardPage):
         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 = []
@@ -82,43 +76,4 @@ class BCreationPage(BWizardPage):
             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
 
diff --git a/wizard/BFinalPage.py b/wizard/BFinalPage.py
new file mode 100644 (file)
index 0000000..04b1f50
--- /dev/null
@@ -0,0 +1,30 @@
+#!/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
index e3d99278ee28aff46499b70bea2d1e2a9e61c52c..5fd3abc8c074e676cf59a925b58fb8b15c815aef 100644 (file)
@@ -27,9 +27,11 @@ class BModulePage(BWizardPage):
         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()
index 221f320179d08be05ff843c79b62efd29a08e0a2..7c2b0f4bc6c73c0302c3db77d8b74f61307a6aaa 100644 (file)
@@ -21,6 +21,7 @@ import BToolchainPage
 import BModulePage
 import BOutputPage
 import BCreationPage
+import BFinalPage
 
 class BWizard(QWizard):
     
@@ -29,6 +30,7 @@ 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()
     
@@ -40,6 +42,7 @@ class BWizard(QWizard):
         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)
@@ -53,4 +56,4 @@ class BWizard(QWizard):
             page.reloadData()
     
     def project(self):
-        return copy.deepcopy(QApplication.instance().project)
\ No newline at end of file
+        return copy.deepcopy(QApplication.instance().project)
diff --git a/wizard/ui/final_page.ui b/wizard/ui/final_page.ui
new file mode 100644 (file)
index 0000000..67c5d6d
--- /dev/null
@@ -0,0 +1,52 @@
+<?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>
index 772d44a44f5fd81ca1e2a433e4ef2ae49ca099b8..19ffc2f660cea50e4cfdf68f1ab9c6eaf62f78a5 100644 (file)
@@ -1,7 +1,8 @@
-<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>