8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import QDir, pyqtSlot |
12 from PyQt4.QtCore import QDir, pyqtSlot |
13 from PyQt4.QtGui import QDialog |
13 from PyQt4.QtGui import QDialog, QDialogButtonBox |
14 |
14 |
15 from E5Gui.E5Application import e5App |
15 from E5Gui.E5Application import e5App |
16 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter |
16 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter |
17 from E5Gui import E5FileDialog |
17 from E5Gui import E5FileDialog |
18 |
18 |
53 projectTypes = project.getProjectTypes() |
53 projectTypes = project.getProjectTypes() |
54 self.projectTypeComboBox.clear() |
54 self.projectTypeComboBox.clear() |
55 for projectType in sorted(projectTypes.keys()): |
55 for projectType in sorted(projectTypes.keys()): |
56 self.projectTypeComboBox.addItem( |
56 self.projectTypeComboBox.addItem( |
57 projectTypes[projectType], projectType) |
57 projectTypes[projectType], projectType) |
|
58 |
|
59 ipath = Preferences.getMultiProject("Workspace") or \ |
|
60 Utilities.getHomeDir() |
|
61 self.__initPaths = [ |
|
62 Utilities.fromNativeSeparators(ipath), |
|
63 Utilities.fromNativeSeparators(ipath) + "/", |
|
64 ] |
58 |
65 |
59 if not new: |
66 if not new: |
60 name = os.path.splitext(self.project.pfile)[0] |
67 name = os.path.splitext(self.project.pfile)[0] |
61 self.nameEdit.setText(os.path.basename(name)) |
68 self.nameEdit.setText(os.path.basename(name)) |
62 self.languageComboBox.setCurrentIndex( |
69 self.languageComboBox.setCurrentIndex( |
118 else: |
125 else: |
119 self.languageComboBox.setCurrentIndex( |
126 self.languageComboBox.setCurrentIndex( |
120 self.languageComboBox.findText("Python3")) |
127 self.languageComboBox.findText("Python3")) |
121 self.projectTypeComboBox.setCurrentIndex( |
128 self.projectTypeComboBox.setCurrentIndex( |
122 self.projectTypeComboBox.findData("Qt4")) |
129 self.projectTypeComboBox.findData("Qt4")) |
123 hp = Preferences.getMultiProject("Workspace") or \ |
130 self.dirEdit.setText(self.__initPaths[0]) |
124 Utilities.getHomeDir() |
|
125 self.dirEdit.setText(hp) |
|
126 self.versionEdit.setText('0.1') |
131 self.versionEdit.setText('0.1') |
127 self.vcsLabel.hide() |
132 self.vcsLabel.hide() |
128 self.vcsInfoButton.hide() |
133 self.vcsInfoButton.hide() |
129 if not self.project.vcsSoftwareAvailable(): |
134 if not self.project.vcsSoftwareAvailable(): |
130 self.vcsCheckBox.hide() |
135 self.vcsCheckBox.hide() |
|
136 |
|
137 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
138 bool(self.dirEdit.text()) and |
|
139 Utilities.fromNativeSeparators(self.dirEdit.text()) not in |
|
140 self.__initPaths) |
131 |
141 |
132 @pyqtSlot(str) |
142 @pyqtSlot(str) |
133 def on_languageComboBox_currentIndexChanged(self, language): |
143 def on_languageComboBox_currentIndexChanged(self, language): |
134 """ |
144 """ |
135 Private slot handling the selection of a programming language. |
145 Private slot handling the selection of a programming language. |
144 self.projectTypeComboBox.addItem( |
154 self.projectTypeComboBox.addItem( |
145 projectTypes[projectType], projectType) |
155 projectTypes[projectType], projectType) |
146 |
156 |
147 self.projectTypeComboBox.setCurrentIndex( |
157 self.projectTypeComboBox.setCurrentIndex( |
148 self.projectTypeComboBox.findData(curProjectType)) |
158 self.projectTypeComboBox.findData(curProjectType)) |
|
159 |
|
160 @pyqtSlot(str) |
|
161 def on_dirEdit_textChanged(self, txt): |
|
162 """ |
|
163 Private slot to handle a change of the project directory. |
|
164 |
|
165 @param txt name of the project directory (string) |
|
166 """ |
|
167 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
168 bool(txt) and |
|
169 Utilities.fromNativeSeparators(txt) not in self.__initPaths) |
149 |
170 |
150 @pyqtSlot() |
171 @pyqtSlot() |
151 def on_dirButton_clicked(self): |
172 def on_dirButton_clicked(self): |
152 """ |
173 """ |
153 Private slot to display a directory selection dialog. |
174 Private slot to display a directory selection dialog. |