--- a/Project/PropertiesDialog.py Wed Mar 05 20:02:28 2014 +0100 +++ b/Project/PropertiesDialog.py Thu Mar 06 18:31:52 2014 +0100 @@ -10,7 +10,7 @@ import os from PyQt4.QtCore import QDir, pyqtSlot -from PyQt4.QtGui import QDialog +from PyQt4.QtGui import QDialog, QDialogButtonBox from E5Gui.E5Application import e5App from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter @@ -56,6 +56,13 @@ self.projectTypeComboBox.addItem( projectTypes[projectType], projectType) + ipath = Preferences.getMultiProject("Workspace") or \ + Utilities.getHomeDir() + self.__initPaths = [ + Utilities.fromNativeSeparators(ipath), + Utilities.fromNativeSeparators(ipath) + "/", + ] + if not new: name = os.path.splitext(self.project.pfile)[0] self.nameEdit.setText(os.path.basename(name)) @@ -120,14 +127,17 @@ self.languageComboBox.findText("Python3")) self.projectTypeComboBox.setCurrentIndex( self.projectTypeComboBox.findData("Qt4")) - hp = Preferences.getMultiProject("Workspace") or \ - Utilities.getHomeDir() - self.dirEdit.setText(hp) + self.dirEdit.setText(self.__initPaths[0]) self.versionEdit.setText('0.1') self.vcsLabel.hide() self.vcsInfoButton.hide() if not self.project.vcsSoftwareAvailable(): self.vcsCheckBox.hide() + + self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + bool(self.dirEdit.text()) and + Utilities.fromNativeSeparators(self.dirEdit.text()) not in + self.__initPaths) @pyqtSlot(str) def on_languageComboBox_currentIndexChanged(self, language): @@ -147,6 +157,17 @@ self.projectTypeComboBox.setCurrentIndex( self.projectTypeComboBox.findData(curProjectType)) + @pyqtSlot(str) + def on_dirEdit_textChanged(self, txt): + """ + Private slot to handle a change of the project directory. + + @param txt name of the project directory (string) + """ + self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( + bool(txt) and + Utilities.fromNativeSeparators(txt) not in self.__initPaths) + @pyqtSlot() def on_dirButton_clicked(self): """