Add the CreateProject page
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 4 Feb 2009 18:12:05 +0000 (18:12 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 4 Feb 2009 18:12:05 +0000 (18:12 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2260 38d2e660-2303-0410-9eaa-f027e97ec537

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

diff --git a/wizard/BCreationPage.py b/wizard/BCreationPage.py
new file mode 100644 (file)
index 0000000..f3e0a11
--- /dev/null
@@ -0,0 +1,78 @@
+#!/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>
+#
+
+from PyQt4.QtGui import *
+
+from BWizardPage import *
+import bertos_utils
+
+from const import *
+
+class BCreationPage(BWizardPage):
+    
+    def __init__(self):
+        BWizardPage.__init__(self, UI_LOCATION + "/project_creation.ui")
+        self.setTitle(self.tr("Create the BeRTOS project"))
+        self._setupUi()
+        self._connectSignals()
+    
+    def _setupUi(self):
+        self._confirmGroup = QWidgetGroup(self.pageContent.summaryTree,
+                                            self.pageContent.createButton)
+        self._workingGroup = QWidgetGroup(self.pageContent.spinnerLabel)
+        self._workingGroup.setVisible(False)
+        self._finalGroup = QWidgetGroup(self.pageContent.iconLabel,
+                                            self.pageContent.textLabel)
+        self._finalGroup.setVisible(False)
+    
+    def _connectSignals(self):
+        self.connect(self.pageContent.createButton, SIGNAL("clicked(bool)"), self._createProject)
+    
+    def _createProject(self):
+        self._confirmGroup.setVisible(False)
+        #self._workingGroup.setVisible(True)
+        #self._movie = QMovie("images/load_spinner.gif")
+        #print self._movie.isValid()
+        #self.pageContent.spinnerLabel.setMovie(self._movie)
+        #self._movie.start()
+        bertos_utils.createBertosProject(self.wizard().project())
+        #del self._movie
+        #self._workingGroup.setVisible(False)
+        self._finalGroup.setVisible(True)
+        self.emit(SIGNAL("completeChanged()"))
+    
+    def isComplete(self):
+        return self._finalGroup.isVisible()
+
+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
+
index 23f05a096bcbd32eb40f3d9eb888fa46fffee84e..a9bff88f0990f5e4caf90bf2709301ef9194ac4e 100644 (file)
@@ -20,6 +20,7 @@ import BCpuPage
 import BToolchainPage
 import BModulePage
 import BOutputPage
+import BCreationPage
 
 class BWizard(QWizard):
     
@@ -38,6 +39,7 @@ class BWizard(QWizard):
         self.addPage(BToolchainPage.BToolchainPage())
         self.addPage(BModulePage.BModulePage())
         self.addPage(BOutputPage.BOutputPage())
+        self.addPage(BCreationPage.BCreationPage())
     
     def _connectSignals(self):
         self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)
diff --git a/wizard/ui/project_creation.ui b/wizard/ui/project_creation.ui
new file mode 100644 (file)
index 0000000..d3f31c8
--- /dev/null
@@ -0,0 +1,113 @@
+<ui version="4.0" >
+ <class>Form</class>
+ <widget class="QWidget" name="Form" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>402</width>
+    <height>336</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QTreeWidget" name="summaryTree" >
+     <column>
+      <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_2" >
+     <item>
+      <spacer name="horizontalSpacer_2" >
+       <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="QLabel" name="spinnerLabel" >
+       <property name="text" >
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_3" >
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0" >
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </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" />
+ </resources>
+ <connections/>
+</ui>