From d7bc79d9a4075745a39715af462e2b9a8dfbcc8e Mon Sep 17 00:00:00 2001 From: duplo Date: Tue, 31 Mar 2009 09:00:34 +0000 Subject: [PATCH] Add a final page after the project creation git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2443 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCreationPage.py | 47 +------------------------- wizard/BFinalPage.py | 30 +++++++++++++++++ wizard/BModulePage.py | 2 ++ wizard/BWizard.py | 5 ++- wizard/ui/final_page.ui | 52 +++++++++++++++++++++++++++++ wizard/ui/project_creation.ui | 62 +++++------------------------------ 6 files changed, 98 insertions(+), 100 deletions(-) create mode 100644 wizard/BFinalPage.py create mode 100644 wizard/ui/final_page.ui diff --git a/wizard/BCreationPage.py b/wizard/BCreationPage.py index 892f9e82..8b2158f3 100644 --- a/wizard/BCreationPage.py +++ b/wizard/BCreationPage.py @@ -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 index 00000000..04b1f507 --- /dev/null +++ b/wizard/BFinalPage.py @@ -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 +# + +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 diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index e3d99278..5fd3abc8 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -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() diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 221f3201..7c2b0f4b 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -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 index 00000000..67c5d6d1 --- /dev/null +++ b/wizard/ui/final_page.ui @@ -0,0 +1,52 @@ + + + Form + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + 0 + 0 + + + + + + + :/images/ok.png + + + + + + + QFrame::Plain + + + Project created successfully. Now start develop your BeRTOS application! + + + true + + + + + + + + + + diff --git a/wizard/ui/project_creation.ui b/wizard/ui/project_creation.ui index 772d44a4..19ffc2f6 100644 --- a/wizard/ui/project_creation.ui +++ b/wizard/ui/project_creation.ui @@ -1,7 +1,8 @@ - + + Form - - + + 0 0 @@ -9,68 +10,23 @@ 336 - + Form - + - + - + 1 - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Create - - - - - - - - - - - - - - :/images/ok.png - - - - - - - The project has been created correctly - - - - - - + -- 2.25.1