4 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
9 # Author: Lorenzo Berni <duplo@develer.com>
14 from PyQt4.QtGui import *
15 from BWizardPage import *
18 class BFolderPage(BWizardPage):
21 BWizardPage.__init__(self, "dir_select.ui")
22 self.setTitle(self.tr("Select the project name"))
23 self._initializeAttributes()
24 self._connectSignals()
26 def _initializeAttributes(self):
27 self._projectName = ""
28 self._destinationFolder = ""
30 def _connectSignals(self):
31 self.connect(self.pageContent.nameEdit, SIGNAL("textChanged(const QString)"), self._nameChanged)
32 self.connect(self.pageContent.directoryEdit, SIGNAL("textChanged(const QString)"), self._directoryChanged)
33 self.connect(self.pageContent.directoryButton, SIGNAL("clicked()"), self._selectDirectory)
35 def _nameChanged(self, name):
36 self._projectName = str(name).replace(" ", "_")
37 self._setProjectPath()
39 def _directoryChanged(self, directory):
40 self._destinationFolder = str(directory)
41 self._setProjectPath()
43 def _setProjectPath(self):
44 if self._destinationFolder <> "" and self._projectName <> "":
45 if not self._destinationFolder.endswith(os.sep):
46 self._destinationFolder += os.sep
47 self.pageContent.projectPath.setText(self._destinationFolder + self._projectName + "/")
49 self.pageContent.projectPath.setText("None")
50 self.emit(SIGNAL("completeChanged()"))
52 def _selectDirectory(self):
53 directory = QFileDialog.getExistingDirectory(self, self.tr("Open Directory"), "", QFileDialog.ShowDirsOnly)
54 self.pageContent.directoryEdit.setText(directory)
57 return self.pageContent.projectPath.text() != "None"