Fixed an issue creating new projects.

Thu, 06 Mar 2014 18:24:39 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 06 Mar 2014 18:24:39 +0100
changeset 3334
a75328ebac64
parent 3333
dcd4391e9d43
child 3337
49faa820151a

Fixed an issue creating new projects.

Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.ui 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	Thu Mar 06 18:22:32 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.py	Thu Mar 06 18:24:39 2014 +0100
@@ -57,14 +57,32 @@
         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.largeCheckBox.setEnabled(self.vcs.isExtensionActive("largefiles"))
+        self.lfNoteLabel.setVisible(self.vcs.isExtensionActive("largefiles"))
+        self.largeCheckBox.setVisible(self.vcs.isExtensionActive("largefiles"))
         
         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/vcsMercurial/HgNewProjectOptionsDialog.ui	Thu Mar 06 18:22:32 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgNewProjectOptionsDialog.ui	Thu Mar 06 18:24:39 2014 +0100
@@ -116,7 +116,7 @@
     </widget>
    </item>
    <item row="5" column="0" colspan="3">
-    <widget class="QLabel" name="label">
+    <widget class="QLabel" name="lfNoteLabel">
      <property name="text">
       <string>&lt;b&gt;Note:&lt;/b&gt; This option increases the download time and volume.</string>
      </property>
--- a/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py	Thu Mar 06 18:22:32 2014 +0100
+++ b/Plugins/VcsPlugins/vcsPySvn/SvnNewProjectOptionsDialog.py	Thu Mar 06 18:24:39 2014 +0100
@@ -57,9 +57,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	Thu Mar 06 18:22:32 2014 +0100
+++ b/Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py	Thu Mar 06 18:24:39 2014 +0100
@@ -57,9 +57,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	Thu Mar 06 18:22:32 2014 +0100
+++ b/Project/PropertiesDialog.py	Thu Mar 06 18:24:39 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
@@ -60,6 +60,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))
@@ -124,14 +131,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):
@@ -151,6 +161,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