--- a/src/eric7/Debugger/DebugUI.py Mon Feb 12 18:09:53 2024 +0100 +++ b/src/eric7/Debugger/DebugUI.py Mon Feb 12 18:12:41 2024 +0100 @@ -2048,6 +2048,13 @@ self.clientType = editor.determineFileType() self.lastStartAction = 5 + if ( + FileSystemUtilities.isRemoteFileName(fn) + and not self.ui.isEricServerConnected() + ): + self.__showNotConnectedWarning(title=cap) + return + # save the filename for use by the restart method self.lastDebuggedFile = fn self.restartAct.setEnabled(True) @@ -2243,6 +2250,13 @@ self.clientType = editor.determineFileType() self.lastStartAction = 7 + if ( + FileSystemUtilities.isRemoteFileName(fn) + and not self.ui.isEricServerConnected() + ): + self.__showNotConnectedWarning(title=cap) + return + # save the filename for use by the restart method self.lastDebuggedFile = fn self.restartAct.setEnabled(True) @@ -2433,6 +2447,13 @@ self.clientType = editor.determineFileType() self.lastStartAction = 3 + if ( + FileSystemUtilities.isRemoteFileName(fn) + and not self.ui.isEricServerConnected() + ): + self.__showNotConnectedWarning(title=cap) + return + # save the filename for use by the restart method self.lastDebuggedFile = fn self.restartAct.setEnabled(True) @@ -2515,8 +2536,8 @@ @param debugProject flag indicating debugging the current project (True) or script (False) @type bool - @param script name of a script (optional) - @type str + @param script name of a script (defaults to "") + @type str (optional) """ from .StartDialog import StartDialog, StartDialogMode @@ -2636,6 +2657,13 @@ self.clientType = editor.determineFileType() self.lastStartAction = 1 + if ( + FileSystemUtilities.isRemoteFileName(fn) + and not self.ui.isEricServerConnected() + ): + self.__showNotConnectedWarning(title=cap) + return + # save the filename for use by the restart method self.lastDebuggedFile = fn self.restartAct.setEnabled(True) @@ -2828,6 +2856,13 @@ self.viewmanager.unhighlight() if not doNotStart: + if ( + FileSystemUtilities.isRemoteFileName(fn) + and not self.ui.isEricServerConnected() + ): + self.__showNotConnectedWarning(title=self.tr("Restart")) + return + if forProject and self.project.getProjectType() in ["E7Plugin"]: argv = '--plugin="{0}" {1}'.format(fn, argv) fn = "" # script name of the eric IDE is set in debug client @@ -3169,3 +3204,20 @@ @rtype str """ return self.debugServer.getProjectEnvironmentString() + + def __showNotConnectedWarning(self, title): + """ + Private method to show a warning about a not connected eric-ide server. + + @param title title for the dialog + @type str + """ + EricMessageBox.warning( + None, + title, + self.tr( + "<p>The selected file is located on an eric-ide server but no such" + " server is connected. Aborting...</p>" + ), + ) +