4 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
12 from BWizardPage import *
15 class BStartPage(BWizardPage):
18 BWizardPage.__init__(self, "start.ui")
19 self._connectSignals()
20 self.setTitle(self.tr("Create or edit a BeRTOS project"))
21 self._initializeButtons()
24 def _connectSignals(self):
25 self.connect(self.pageContent.newButton, SIGNAL("clicked()"), self.newProject)
26 self.connect(self.pageContent.editButton, SIGNAL("clicked()"), self.editProject)
28 def _initializeButtons(self):
29 self.buttonGroup = QButtonGroup()
30 self.buttonGroup.addButton(self.pageContent.newButton)
31 self.buttonGroup.addButton(self.pageContent.editButton)
32 self.buttonGroup.setExclusive(True)
35 self.pageContent.newDescription.setVisible(False)
36 self.pageContent.editDescription.setVisible(False)
39 return self.pageContent.newButton.isChecked() or self.pageContent.editButton.isChecked()
42 filename = QFileDialog.getSaveFileName(self, self.tr("Destination directory"), "", "", "", QFileDialog.ShowDirsOnly)
43 if not filename.isEmpty():
44 self.pageContent.newDescription.setText("(\"" + filename + "\")")
45 self.pageContent.newDescription.setVisible(True)
46 # TODO: It's better to create it at the end of the wizard...
47 bertos_utils.createBertosProject(filename)
48 self.emit(SIGNAL("completeChanged()"))
50 self.pageContent.newDescription.setText("")
51 self.pageContent.newDescription.setVisible(False)
52 self.pageContent.newButton.setChecked(False)
54 def editProject(self):
55 self.pageContent.newButton.setChecked(False)