From: duplo Date: Wed, 4 Feb 2009 18:12:05 +0000 (+0000) Subject: Add the CreateProject page X-Git-Tag: 2.1.0~422 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=39cfcb3a18a672e4a5b07710597d074175dad593;p=bertos.git Add the CreateProject page git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2260 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BCreationPage.py b/wizard/BCreationPage.py new file mode 100644 index 00000000..f3e0a115 --- /dev/null +++ b/wizard/BCreationPage.py @@ -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 +# + +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 + diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 23f05a09..a9bff88f 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -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 index 00000000..d3f31c81 --- /dev/null +++ b/wizard/ui/project_creation.ui @@ -0,0 +1,113 @@ + + Form + + + + 0 + 0 + 402 + 336 + + + + Form + + + + + + + 1 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Create + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + :/images/ok.png + + + + + + + The project has been created correctly + + + + + + + + + + + +