src/eric7/Project/PropertiesDialog.py

branch
eric7-maintenance
changeset 11063
bb05d1db9286
parent 11019
27cd57e98461
parent 11040
a4fd43ac7923
child 11118
967a88a16a21
--- a/src/eric7/Project/PropertiesDialog.py	Thu Oct 31 10:54:59 2024 +0100
+++ b/src/eric7/Project/PropertiesDialog.py	Sat Nov 30 11:08:07 2024 +0100
@@ -97,13 +97,19 @@
             self.projectTypeComboBox.addItem(projectType[0], projectType[1])
 
         if self.__remoteProject:
-            self.__initPaths = [self.__remotefsInterface.getcwd()]
+            ipath = self.__remotefsInterface.getcwd()
+            self.__initPaths = [ipath, ipath + self.__remotefsInterface.separator()]
         else:
             ipath = Preferences.getMultiProject("Workspace") or OSUtilities.getHomeDir()
             self.__initPaths = [
                 FileSystemUtilities.fromNativeSeparators(ipath),
                 FileSystemUtilities.fromNativeSeparators(ipath) + "/",
             ]
+        self.dirInfoLabel.setText(
+            self.tr("<p>The project directory must not be '<b>{0}</b>'.</p>").format(
+                ipath
+            )
+        )
 
         self.licenseComboBox.lineEdit().setClearButtonEnabled(True)
         self.__populateLicenseComboBox()
@@ -222,10 +228,26 @@
         self.mixedLanguageCheckBox.stateChanged.connect(self.__initFileTypesDict)
         self.projectTypeComboBox.currentIndexChanged.connect(self.__initFileTypesDict)
 
-        self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
-            bool(self.dirPicker.text())
-            and self.dirPicker.text() not in self.__initPaths
-        )
+        self.__updateOk()
+
+    def __updateOk(self):
+        """
+        Private method to update the state of the OK button.
+        """
+        projectDir = self.dirPicker.text()
+        if self.__remoteProject:
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
+                FileSystemUtilities.isRemoteFileName(projectDir)
+                and not self.__remotefsInterface.isEmpty(projectDir)
+                and projectDir not in self.__initPaths
+            )
+        else:
+            self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
+                bool(projectDir)
+                and not FileSystemUtilities.isRemoteFileName(projectDir)
+                and FileSystemUtilities.fromNativeSeparators(projectDir)
+                not in self.__initPaths
+            )
 
     def __setMainScriptPickerFilters(self):
         """
@@ -295,17 +317,7 @@
         @param txt name of the project directory
         @type str
         """
-        if self.__remoteProject:
-            self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
-                FileSystemUtilities.isRemoteFileName(txt)
-                and txt not in self.__initPaths
-            )
-        else:
-            self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
-                bool(txt)
-                and FileSystemUtilities.fromNativeSeparators(txt)
-                not in self.__initPaths
-            )
+        self.__updateOk()
 
     @pyqtSlot(str)
     def on_srcDirPicker_pathSelected(self, srcDir):

eric ide

mercurial