--- a/QScintilla/ShellWindow.py Fri Apr 21 19:39:31 2017 +0200 +++ b/QScintilla/ShellWindow.py Sat Apr 22 15:37:18 2017 +0200 @@ -9,7 +9,11 @@ from __future__ import unicode_literals -from PyQt5.QtCore import Qt, QCoreApplication, QPoint, QSize, QSignalMapper +import sys +import os + +from PyQt5.QtCore import Qt, QCoreApplication, QPoint, QSize, QSignalMapper, \ + QProcess from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QAction, \ QWhatsThis, QDialog @@ -33,6 +37,8 @@ from Debugger.DebugServer import DebugServer from UI.SearchWidget import SearchWidget +from eric6config import getConfig + class ShellWindow(E5MainWindow): """ @@ -98,7 +104,8 @@ """ Protected method to handle the close event. - @param event close event (QCloseEvent) + @param event close event + @type QCloseEvent """ self.__writeSettings() self.__debugServer.shutdownServer() @@ -126,8 +133,10 @@ """ Private function to read a single keyboard shortcut from the settings. - @param act reference to the action object (E5Action) - @param category category the action belongs to (string) + @param act reference to the action object + @type E5Action + @param category category the action belongs to + @type str """ if act.objectName(): accel = Preferences.Prefs.settings.value( @@ -181,7 +190,7 @@ self.tr('&Quit'), QKeySequence(self.tr("Ctrl+Q", "File|Quit")), 0, self, 'quit') - self.exitAct.setStatusTip(self.tr('Quit the IDE')) + self.exitAct.setStatusTip(self.tr('Quit the Shell')) self.exitAct.setWhatsThis(self.tr( """<b>Quit the Shell</b>""" """<p>This quits the Shell window.</p>""" @@ -189,21 +198,21 @@ self.exitAct.triggered.connect(self.quit) self.exitAct.setMenuRole(QAction.QuitRole) self.fileActions.append(self.exitAct) -## -## self.newWindowAct = E5Action( -## self.tr('New Window'), -## UI.PixmapCache.getIcon("newWindow.png"), -## self.tr('New &Window'), -## QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), -## 0, self, 'new_window') -## self.newWindowAct.setStatusTip(self.tr( -## 'Open a new eric6 instance')) -## self.newWindowAct.setWhatsThis(self.tr( -## """<b>New Window</b>""" -## """<p>This opens a new instance of the eric6 IDE.</p>""" -## )) -## self.newWindowAct.triggered.connect(self.__newWindow) -## self.fileActions.append(self.newWindowAct) + + self.newWindowAct = E5Action( + self.tr('New Window'), + UI.PixmapCache.getIcon("newWindow.png"), + self.tr('New &Window'), + QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")), + 0, self, 'new_window') + self.newWindowAct.setStatusTip(self.tr( + 'Open a new Shell window')) + self.newWindowAct.setWhatsThis(self.tr( + """<b>New Window</b>""" + """<p>This opens a new instance of the Shell window.</p>""" + )) + self.newWindowAct.triggered.connect(self.__newWindow) + self.fileActions.append(self.newWindowAct) self.restartAct = E5Action( self.tr('Restart'), @@ -972,6 +981,15 @@ self.__doRestart() self.__shell.clear() + def __newWindow(self): + """ + Private slot to start a new instance of eric6. + """ + program = sys.executable + eric6 = os.path.join(getConfig("ericDir"), "eric6_shell.py") + args = [eric6] + QProcess.startDetached(program, args) + ################################################################## ## Below are the action methods for the view menu ################################################################## @@ -1011,7 +1029,8 @@ """ Private slot to zoom to a given value. - @param value zoom value to be set (integer) + @param value zoom value to be set + @type int """ self.__shell.zoomTo(value) self.__sbZoom.setValue(self.__shell.getZoom()) @@ -1020,7 +1039,8 @@ """ Private slot to handle changes of the zoom value. - @param value new zoom value (integer) + @param value new zoom value + @type int """ self.__sbZoom.setValue(value) @@ -1062,8 +1082,8 @@ """ self.__fileMenu = self.menuBar().addMenu(self.tr("&File")) self.__fileMenu.setTearOffEnabled(True) -## self.__fileMenu.addAction(self.newAct) -## self.__fileMenu.addSeparator() + self.__fileMenu.addAction(self.newWindowAct) + self.__fileMenu.addSeparator() self.__fileMenu.addAction(self.restartAct) self.__fileMenu.addAction(self.clearRestartAct) self.__fileMenu.addSeparator() @@ -1136,7 +1156,7 @@ """ filetb = self.addToolBar(self.tr("File")) filetb.setIconSize(UI.Config.ToolBarIconSize) -## filetb.addAction(self.newAct) + filetb.addAction(self.newWindowAct) filetb.addSeparator() filetb.addAction(self.restartAct) filetb.addAction(self.clearRestartAct)