Fixed an issue creating new projects. 5_4_x

Thu, 06 Mar 2014 18:31:52 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 06 Mar 2014 18:31:52 +0100
branch
5_4_x
changeset 3335
0e973a74be62
parent 3331
3a723d9cfa6a
child 3336
dab3f3978e57

Fixed an issue creating new projects.

Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py file | annotate | diff | comparison | revisions
Project/PropertiesDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py	Wed Mar 05 20:02:28 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py	Thu Mar 06 18:31:52 2014 +0100
@@ -53,10 +53,29 @@
         self.networkPath = "localhost/"
         self.localProtocol = True
         
+        ipath = Preferences.getMultiProject("Workspace") or \
+            Utilities.getHomeDir()
+        self.__initPaths = [
+            Utilities.fromNativeSeparators(ipath),
+            Utilities.fromNativeSeparators(ipath) + "/",
+        ]
         self.vcsProjectDirEdit.setText(
-            Utilities.toNativeSeparators(
-                Preferences.getMultiProject("Workspace") or
-                Utilities.getHomeDir()))
+           Utilities.toNativeSeparators(self.__initPaths[0]))
+        
+        self.resize(self.width(), self.minimumSizeHint().height())
+        
+        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
+    
+    @pyqtSlot(str)
+    def on_vcsProjectDirEdit_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_vcsUrlButton_clicked(self):
--- a/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py	Wed Mar 05 20:02:28 2014 +0100
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py	Thu Mar 06 18:31:52 2014 +0100
@@ -53,9 +53,29 @@
         self.networkPath = "localhost/"
         self.localProtocol = True
         
-        self.vcsProjectDirEdit.setText(Utilities.toNativeSeparators(
-            Preferences.getMultiProject("Workspace") or
-            Utilities.getHomeDir()))
+        ipath = Preferences.getMultiProject("Workspace") or \
+            Utilities.getHomeDir()
+        self.__initPaths = [
+            Utilities.fromNativeSeparators(ipath),
+            Utilities.fromNativeSeparators(ipath) + "/",
+        ]
+        self.vcsProjectDirEdit.setText(
+            Utilities.toNativeSeparators(self.__initPaths[0]))
+        
+        self.resize(self.width(), self.minimumSizeHint().height())
+        
+        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
+    
+    @pyqtSlot(str)
+    def on_vcsProjectDirEdit_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_vcsUrlButton_clicked(self):
--- a/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py	Wed Mar 05 20:02:28 2014 +0100
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py	Thu Mar 06 18:31:52 2014 +0100
@@ -53,9 +53,29 @@
         self.networkPath = "localhost/"
         self.localProtocol = True
         
-        self.vcsProjectDirEdit.setText(Utilities.toNativeSeparators(
-            Preferences.getMultiProject("Workspace") or
-            Utilities.getHomeDir()))
+        ipath = Preferences.getMultiProject("Workspace") or \
+            Utilities.getHomeDir()
+        self.__initPaths = [
+            Utilities.fromNativeSeparators(ipath),
+            Utilities.fromNativeSeparators(ipath) + "/",
+        ]
+        self.vcsProjectDirEdit.setText(
+            Utilities.toNativeSeparators(self.__initPaths[0]))
+        
+        self.resize(self.width(), self.minimumSizeHint().height())
+        
+        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
+    
+    @pyqtSlot(str)
+    def on_vcsProjectDirEdit_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_vcsUrlButton_clicked(self):
--- 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):
         """

eric ide

mercurial