--- a/UI/UserInterface.py Tue Jul 10 19:11:06 2018 +0200 +++ b/UI/UserInterface.py Tue Jul 10 19:16:02 2018 +0200 @@ -1367,6 +1367,22 @@ self.exitAct.setMenuRole(QAction.QuitRole) self.actions.append(self.exitAct) + self.restartAct = E5Action( + self.tr('Restart'), + UI.PixmapCache.getIcon("restart.png"), + self.tr('Restart'), + QKeySequence(self.tr("Ctrl+Alt+Q", "File|Quit")), + 0, self, 'restart_eric') + self.restartAct.setStatusTip(self.tr('Restart the IDE')) + self.restartAct.setWhatsThis(self.tr( + """<b>Restart the IDE</b>""" + """<p>This restarts the IDE. Any unsaved changes may be saved""" + """ first. Any Python program being debugged will be stopped""" + """ and the preferences will be written to disc.</p>""" + )) + self.restartAct.triggered.connect(self.__restart) + self.actions.append(self.restartAct) + self.saveSessionAct = E5Action( self.tr('Save session'), self.tr('Save session...'), @@ -2667,6 +2683,7 @@ self.__menus["file"].addAction(self.saveSessionAct) self.__menus["file"].addAction(self.loadSessionAct) self.__menus["file"].addSeparator() + self.__menus["file"].addAction(self.restartAct) self.__menus["file"].addAction(self.exitAct) act = self.__menus["file"].actions()[0] sep = self.__menus["file"].insertSeparator(act) @@ -2910,6 +2927,7 @@ pluginstb.setToolTip(self.tr("Plugins")) filetb.addSeparator() + filetb.addAction(self.restartAct) filetb.addAction(self.exitAct) act = filetb.actions()[0] sep = filetb.insertSeparator(act) @@ -3613,16 +3631,23 @@ if self.__shutdown(): e5App().closeAllWindows() - def __restart(self): + @pyqtSlot() + def __restart(self, ask=False): """ Private method to restart the application. - """ - res = E5MessageBox.yesNo( - self, - self.tr("Restart application"), - self.tr( - """The application needs to be restarted. Do it now?"""), - yesDefault=True) + + @param ask flag indicating to ask the user for permission + @type bool + """ + if ask: + res = E5MessageBox.yesNo( + self, + self.tr("Restart application"), + self.tr( + """The application needs to be restarted. Do it now?"""), + yesDefault=True) + else: + res = True if res and self.__shutdown(): e5App().closeAllWindows() @@ -6339,7 +6364,7 @@ self) dlg.exec_() if dlg.restartNeeded(): - self.__restart() + self.__restart(ask=True) def __deinstallPlugin(self): """