Project/PropertiesDialog.py

changeset 3334
a75328ebac64
parent 3190
a9a94491c4fd
child 3359
6b6c224d67d6
equal deleted inserted replaced
3333:dcd4391e9d43 3334:a75328ebac64
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
57 projectTypes = project.getProjectTypes() 57 projectTypes = project.getProjectTypes()
58 self.projectTypeComboBox.clear() 58 self.projectTypeComboBox.clear()
59 for projectType in sorted(projectTypes.keys()): 59 for projectType in sorted(projectTypes.keys()):
60 self.projectTypeComboBox.addItem( 60 self.projectTypeComboBox.addItem(
61 projectTypes[projectType], projectType) 61 projectTypes[projectType], projectType)
62
63 ipath = Preferences.getMultiProject("Workspace") or \
64 Utilities.getHomeDir()
65 self.__initPaths = [
66 Utilities.fromNativeSeparators(ipath),
67 Utilities.fromNativeSeparators(ipath) + "/",
68 ]
62 69
63 if not new: 70 if not new:
64 name = os.path.splitext(self.project.pfile)[0] 71 name = os.path.splitext(self.project.pfile)[0]
65 self.nameEdit.setText(os.path.basename(name)) 72 self.nameEdit.setText(os.path.basename(name))
66 self.languageComboBox.setCurrentIndex( 73 self.languageComboBox.setCurrentIndex(
122 else: 129 else:
123 self.languageComboBox.setCurrentIndex( 130 self.languageComboBox.setCurrentIndex(
124 self.languageComboBox.findText("Python3")) 131 self.languageComboBox.findText("Python3"))
125 self.projectTypeComboBox.setCurrentIndex( 132 self.projectTypeComboBox.setCurrentIndex(
126 self.projectTypeComboBox.findData("Qt4")) 133 self.projectTypeComboBox.findData("Qt4"))
127 hp = Preferences.getMultiProject("Workspace") or \ 134 self.dirEdit.setText(self.__initPaths[0])
128 Utilities.getHomeDir()
129 self.dirEdit.setText(hp)
130 self.versionEdit.setText('0.1') 135 self.versionEdit.setText('0.1')
131 self.vcsLabel.hide() 136 self.vcsLabel.hide()
132 self.vcsInfoButton.hide() 137 self.vcsInfoButton.hide()
133 if not self.project.vcsSoftwareAvailable(): 138 if not self.project.vcsSoftwareAvailable():
134 self.vcsCheckBox.hide() 139 self.vcsCheckBox.hide()
140
141 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
142 bool(self.dirEdit.text()) and
143 Utilities.fromNativeSeparators(self.dirEdit.text()) not in
144 self.__initPaths)
135 145
136 @pyqtSlot(str) 146 @pyqtSlot(str)
137 def on_languageComboBox_currentIndexChanged(self, language): 147 def on_languageComboBox_currentIndexChanged(self, language):
138 """ 148 """
139 Private slot handling the selection of a programming language. 149 Private slot handling the selection of a programming language.
148 self.projectTypeComboBox.addItem( 158 self.projectTypeComboBox.addItem(
149 projectTypes[projectType], projectType) 159 projectTypes[projectType], projectType)
150 160
151 self.projectTypeComboBox.setCurrentIndex( 161 self.projectTypeComboBox.setCurrentIndex(
152 self.projectTypeComboBox.findData(curProjectType)) 162 self.projectTypeComboBox.findData(curProjectType))
163
164 @pyqtSlot(str)
165 def on_dirEdit_textChanged(self, txt):
166 """
167 Private slot to handle a change of the project directory.
168
169 @param txt name of the project directory (string)
170 """
171 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
172 bool(txt) and
173 Utilities.fromNativeSeparators(txt) not in self.__initPaths)
153 174
154 @pyqtSlot() 175 @pyqtSlot()
155 def on_dirButton_clicked(self): 176 def on_dirButton_clicked(self):
156 """ 177 """
157 Private slot to display a directory selection dialog. 178 Private slot to display a directory selection dialog.

eric ide

mercurial