--- a/eric6/QScintilla/Shell.py Mon Apr 26 17:33:08 2021 +0200 +++ b/eric6/QScintilla/Shell.py Tue Apr 27 17:25:06 2021 +0200 @@ -10,8 +10,7 @@ import sys import re import contextlib - -from enum import Enum +import enum from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, Qt, QEvent from PyQt5.QtGui import QClipboard, QPalette, QFont @@ -93,13 +92,13 @@ return self.__shell -class ShellHistoryStyle(Enum): +class ShellHistoryStyle(enum.Enum): """ Class defining the shell history styles. """ - Disabled = 0 - LinuxStyle = 1 - WindowsStyle = 2 + DISABLED = 0 + LINUXSTYLE = 1 + WINDOWSSTYLE = 2 class Shell(QsciScintillaCompat): @@ -243,7 +242,8 @@ dbs.mainClientExit.connect(self.__writePrompt) self.dbs = dbs - self.__debugUI = None + # will register a method to get the debugger ID to work with + self.__getSelectedDebuggerId = None # Make sure we have prompts. if self.passive: @@ -612,7 +612,17 @@ @param ui reference to the debugger UI object (DebugUI) """ ui.exceptionInterrupt.connect(self.__writePrompt) - self.__debugUI = ui + self.registerDebuggerIdMethod(ui.getSelectedDebuggerId) + + def registerDebuggerIdMethod(self, method): + """ + Public method to register a method to get the debugger ID to send data + to. + + @param method reference to the method + @type function + """ + self.__getSelectedDebuggerId = method def __initialise(self): """ @@ -673,7 +683,7 @@ # determine based on history style if ( self.clientType and - self.__historyStyle == ShellHistoryStyle.WindowsStyle + self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE ): idx = int(Preferences.Prefs.settings.value( "Shell/HistoryIndexes/" + self.clientType, -1)) @@ -688,7 +698,7 @@ self.__histidx = -1 if ( self.clientType and - self.__historyStyle == ShellHistoryStyle.WindowsStyle + self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE ): Preferences.Prefs.settings.setValue( "Shell/HistoryIndexes/" + self.clientType, self.__histidx) @@ -1338,7 +1348,7 @@ self.incrementalSearchActive = True if ac and self.racEnabled: self.dbs.remoteCompletion( - self.__debugUI.getSelectedDebuggerId(), + self.__getSelectedDebuggerId(), self.completionText + txt ) else: @@ -1373,7 +1383,7 @@ self.SendScintilla(cmd) elif self.racEnabled: self.dbs.remoteCompletion( - self.__debugUI.getSelectedDebuggerId(), + self.__getSelectedDebuggerId(), buf ) @@ -1404,7 +1414,7 @@ if db and ac and self.racEnabled and self.completionText: delta = len(self.text(line)) - oldLength self.dbs.remoteCompletion( - self.__debugUI.getSelectedDebuggerId(), + self.__getSelectedDebuggerId(), self.completionText[:delta] ) @@ -1797,9 +1807,9 @@ if len(self.__history) == self.__maxHistoryEntries: del self.__history[0] self.__history.append(cmd) - if self.__historyStyle == ShellHistoryStyle.LinuxStyle: + if self.__historyStyle == ShellHistoryStyle.LINUXSTYLE: self.__setHistoryIndex(index=-1) - elif self.__historyStyle == ShellHistoryStyle.WindowsStyle: + elif self.__historyStyle == ShellHistoryStyle.WINDOWSSTYLE: if historyIndex is None: if ( self.__histidx - 1 > 0 and @@ -1887,7 +1897,7 @@ return else: self.dbs.remoteStatement( - self.__debugUI.getSelectedDebuggerId(), cmd) + self.__getSelectedDebuggerId(), cmd) while self.inCommandExecution: with contextlib.suppress(KeyboardInterrupt): QApplication.processEvents() @@ -2364,7 +2374,7 @@ @return flag indicating if history is enabled @rtype bool """ - return self.__historyStyle != ShellHistoryStyle.Disabled + return self.__historyStyle != ShellHistoryStyle.DISABLED ################################################################# ## Project Support