UI/UserInterface.py

changeset 6423
a9e6ae68170b
parent 6422
1b8bff880c6b
child 6424
5e74c4e22e9a
equal deleted inserted replaced
6422:1b8bff880c6b 6423:a9e6ae68170b
1365 )) 1365 ))
1366 self.exitAct.triggered.connect(self.__quit) 1366 self.exitAct.triggered.connect(self.__quit)
1367 self.exitAct.setMenuRole(QAction.QuitRole) 1367 self.exitAct.setMenuRole(QAction.QuitRole)
1368 self.actions.append(self.exitAct) 1368 self.actions.append(self.exitAct)
1369 1369
1370 self.restartAct = E5Action(
1371 self.tr('Restart'),
1372 UI.PixmapCache.getIcon("restart.png"),
1373 self.tr('Restart'),
1374 QKeySequence(self.tr("Ctrl+Alt+Q", "File|Quit")),
1375 0, self, 'restart_eric')
1376 self.restartAct.setStatusTip(self.tr('Restart the IDE'))
1377 self.restartAct.setWhatsThis(self.tr(
1378 """<b>Restart the IDE</b>"""
1379 """<p>This restarts the IDE. Any unsaved changes may be saved"""
1380 """ first. Any Python program being debugged will be stopped"""
1381 """ and the preferences will be written to disc.</p>"""
1382 ))
1383 self.restartAct.triggered.connect(self.__restart)
1384 self.actions.append(self.restartAct)
1385
1370 self.saveSessionAct = E5Action( 1386 self.saveSessionAct = E5Action(
1371 self.tr('Save session'), 1387 self.tr('Save session'),
1372 self.tr('Save session...'), 1388 self.tr('Save session...'),
1373 0, 0, self, 'save_session_to_file') 1389 0, 0, self, 'save_session_to_file')
1374 self.saveSessionAct.setStatusTip(self.tr('Save session')) 1390 self.saveSessionAct.setStatusTip(self.tr('Save session'))
2665 mb.addMenu(self.__menus["file"]) 2681 mb.addMenu(self.__menus["file"])
2666 self.__menus["file"].addSeparator() 2682 self.__menus["file"].addSeparator()
2667 self.__menus["file"].addAction(self.saveSessionAct) 2683 self.__menus["file"].addAction(self.saveSessionAct)
2668 self.__menus["file"].addAction(self.loadSessionAct) 2684 self.__menus["file"].addAction(self.loadSessionAct)
2669 self.__menus["file"].addSeparator() 2685 self.__menus["file"].addSeparator()
2686 self.__menus["file"].addAction(self.restartAct)
2670 self.__menus["file"].addAction(self.exitAct) 2687 self.__menus["file"].addAction(self.exitAct)
2671 act = self.__menus["file"].actions()[0] 2688 act = self.__menus["file"].actions()[0]
2672 sep = self.__menus["file"].insertSeparator(act) 2689 sep = self.__menus["file"].insertSeparator(act)
2673 self.__menus["file"].insertAction(sep, self.newWindowAct) 2690 self.__menus["file"].insertAction(sep, self.newWindowAct)
2674 self.__menus["file"].aboutToShow.connect(self.__showFileMenu) 2691 self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
2908 helptb.setToolTip(self.tr("Help")) 2925 helptb.setToolTip(self.tr("Help"))
2909 profilestb.setToolTip(self.tr("Profiles")) 2926 profilestb.setToolTip(self.tr("Profiles"))
2910 pluginstb.setToolTip(self.tr("Plugins")) 2927 pluginstb.setToolTip(self.tr("Plugins"))
2911 2928
2912 filetb.addSeparator() 2929 filetb.addSeparator()
2930 filetb.addAction(self.restartAct)
2913 filetb.addAction(self.exitAct) 2931 filetb.addAction(self.exitAct)
2914 act = filetb.actions()[0] 2932 act = filetb.actions()[0]
2915 sep = filetb.insertSeparator(act) 2933 sep = filetb.insertSeparator(act)
2916 filetb.insertAction(sep, self.newWindowAct) 2934 filetb.insertAction(sep, self.newWindowAct)
2917 self.toolbarManager.addToolBar(filetb, filetb.windowTitle()) 2935 self.toolbarManager.addToolBar(filetb, filetb.windowTitle())
3611 Private method to quit the application. 3629 Private method to quit the application.
3612 """ 3630 """
3613 if self.__shutdown(): 3631 if self.__shutdown():
3614 e5App().closeAllWindows() 3632 e5App().closeAllWindows()
3615 3633
3616 def __restart(self): 3634 @pyqtSlot()
3635 def __restart(self, ask=False):
3617 """ 3636 """
3618 Private method to restart the application. 3637 Private method to restart the application.
3619 """ 3638
3620 res = E5MessageBox.yesNo( 3639 @param ask flag indicating to ask the user for permission
3621 self, 3640 @type bool
3622 self.tr("Restart application"), 3641 """
3623 self.tr( 3642 if ask:
3624 """The application needs to be restarted. Do it now?"""), 3643 res = E5MessageBox.yesNo(
3625 yesDefault=True) 3644 self,
3645 self.tr("Restart application"),
3646 self.tr(
3647 """The application needs to be restarted. Do it now?"""),
3648 yesDefault=True)
3649 else:
3650 res = True
3626 3651
3627 if res and self.__shutdown(): 3652 if res and self.__shutdown():
3628 e5App().closeAllWindows() 3653 e5App().closeAllWindows()
3629 program = sys.executable 3654 program = sys.executable
3630 eric6 = os.path.join(getConfig("ericDir"), "eric6.py") 3655 eric6 = os.path.join(getConfig("ericDir"), "eric6.py")
6337 self.pluginManager, 6362 self.pluginManager,
6338 [] if pluginFileNames is None else pluginFileNames[:], 6363 [] if pluginFileNames is None else pluginFileNames[:],
6339 self) 6364 self)
6340 dlg.exec_() 6365 dlg.exec_()
6341 if dlg.restartNeeded(): 6366 if dlg.restartNeeded():
6342 self.__restart() 6367 self.__restart(ask=True)
6343 6368
6344 def __deinstallPlugin(self): 6369 def __deinstallPlugin(self):
6345 """ 6370 """
6346 Private slot to show a dialog to uninstall a plugin. 6371 Private slot to show a dialog to uninstall a plugin.
6347 """ 6372 """

eric ide

mercurial