From: duplo Date: Thu, 11 Dec 2008 19:41:27 +0000 (+0000) Subject: Add in the first wizard page the possibility of create a new project directory and... X-Git-Tag: 2.1.0~668 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=a1aaf6afee193c215478b124ee8727cd342277d2;p=bertos.git Add in the first wizard page the possibility of create a new project directory and an empty project file clicking on the new project button. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2014 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BStartPage.py b/wizard/BStartPage.py index 8ee076e2..ea39f19f 100644 --- a/wizard/BStartPage.py +++ b/wizard/BStartPage.py @@ -10,6 +10,7 @@ # from BWizardPage import * +from libbertos import * class BStartPage(BWizardPage): @@ -17,15 +18,33 @@ class BStartPage(BWizardPage): BWizardPage.__init__(self, "start.ui") self._connectSignals() self.setTitle(self.tr("Create or edit a beRTOS project")) + self._initializeButtons() + self._setupUi() def _connectSignals(self): - self.connect(self.pageContent.newButton, SIGNAL("clicked()"), lambda: self.mutualExclusion("new")) - self.connect(self.pageContent.editButton, SIGNAL("clicked()"), lambda: self.mutualExclusion("edit")) - - def mutualExclusion(self, button): - if(button == "new"): - self.pageContent.newButton.setChecked(True) - self.pageContent.editButton.setChecked(False) - elif(button == "edit"): - self.pageContent.newButton.setChecked(False) - self.pageContent.editButton.setChecked(True) \ No newline at end of file + self.connect(self.pageContent.newButton, SIGNAL("clicked()"), self.newProject) + self.connect(self.pageContent.editButton, SIGNAL("clicked()"), self.editProject) + + def _initializeButtons(self): + self.buttonGroup = QButtonGroup() + self.buttonGroup.addButton(self.pageContent.newButton) + self.buttonGroup.addButton(self.pageContent.editButton) + self.buttonGroup.setExclusive(True) + + def _setupUi(self): + self.pageContent.newDescription.setVisible(False) + self.pageContent.editDescription.setVisible(False) + + def newProject(self): + filename = QFileDialog.getSaveFileName(self, self.tr("Destination directory"), "", "", "", QFileDialog.ShowDirsOnly) + if not filename.isEmpty(): + self.pageContent.newDescription.setText("(\"" + filename + "\")") + self.pageContent.newDescription.setVisible(True) + # TODO: It's better to create it at the end of the wizard... + createBertosProject(filename) + else: + self.pageContent.newDescription.setText("") + self.pageContent.newDescription.setVisible(False) + + def editProject(self): + pass \ No newline at end of file diff --git a/wizard/start.ui b/wizard/start.ui index 38b0d1d9..7fc0a553 100644 --- a/wizard/start.ui +++ b/wizard/start.ui @@ -5,16 +5,16 @@ 0 0 - 355 + 358 311 Form - + - + @@ -48,16 +48,27 @@ true - true + false - - - Create a new bertos project - - + + + + + Create a new bertos project + + + + + + + + + + + @@ -103,11 +114,22 @@ - - - Edit an existent bertos project - - + + + + + Edit an existent bertos project + + + + + + + + + + +