--- a/QScintilla/ShellWindow.py Sun Nov 04 12:38:32 2018 +0100 +++ b/QScintilla/ShellWindow.py Sun Nov 04 17:20:11 2018 +0100 @@ -45,10 +45,12 @@ """ Class implementing a stand alone shell window. """ - def __init__(self, parent=None, name=None): + def __init__(self, originalPathString, parent=None, name=None): """ Constructor + @param originalPathString original PATH environment variable + @type str @param parent reference to the parent widget @type QWidget @param name object name of the window @@ -58,6 +60,7 @@ if name is not None: self.setObjectName(name) self.setWindowIcon(UI.PixmapCache.getIcon("shell.png")) + self.setWindowTitle(self.tr("eric6 Shell")) self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) @@ -66,7 +69,8 @@ self.__apisManager = APIsManager(parent=self) # initialize the debug server and shell widgets - self.__debugServer = DebugServer(preventPassiveDebugging=True) + self.__debugServer = DebugServer(originalPathString, + preventPassiveDebugging=True) self.__shell = Shell(self.__debugServer, self, None, True, self) self.__searchWidget = SearchWidget(self.__shell, self, showLine=True) @@ -99,8 +103,14 @@ self.virtualenvManager = VirtualenvManager(self) e5App().registerObject("VirtualEnvManager", self.virtualenvManager) - # now start the debug client - self.__debugServer.startClient(False) + self.__shell.virtualEnvironmentChanged.connect( + self.__virtualEnvironmentChanged) + + # now start the debug client with the most recently used virtual + # environment + self.__debugServer.startClient( + False, venvName=Preferences.getShell("LastVirtualEnvironment") + ) # set the keyboard input interval interval = Preferences.getUI("KeyboardInputInterval") @@ -233,7 +243,7 @@ """<b>Restart</b>""" """<p>Restart the shell for the currently selected language.</p>""" )) - self.restartAct.triggered.connect(self.__doRestart) + self.restartAct.triggered.connect(self.__shell.doRestart) self.fileActions.append(self.restartAct) self.clearRestartAct = E5Action( @@ -248,7 +258,7 @@ """<p>Clear the shell window and restart the shell for the""" """ currently selected language.</p>""" )) - self.clearRestartAct.triggered.connect(self.__doClearRestart) + self.clearRestartAct.triggered.connect(self.__shell.doClearRestart) self.fileActions.append(self.clearRestartAct) def __createEditActions(self): @@ -1004,19 +1014,6 @@ """ e5App().closeAllWindows() - def __doRestart(self): - """ - Private slot to handle the 'restart' menu entry. - """ - self.__debugServer.startClient(False) - - def __doClearRestart(self): - """ - Private slot to handle the 'restart and clear' menu entry. - """ - self.__doRestart() - self.__shell.clear() - def __newWindow(self): """ Private slot to start a new instance of eric6. @@ -1026,6 +1023,18 @@ args = [eric6] QProcess.startDetached(program, args) + def __virtualEnvironmentChanged(self, venvName): + """ + Private slot handling a change of the shell's virtual environment. + + @param venvName name of the virtual environment of the shell + @type str + """ + if venvName: + self.setWindowTitle(self.tr("eric6 Shell [{0}]").format(venvName)) + else: + self.setWindowTitle(self.tr("eric6 Shell")) + ################################################################## ## Below are the action methods for the view menu ##################################################################