UI/UserInterface.py

changeset 1453
2be886c8cffb
parent 1368
4489ee4feb59
child 1461
6e8e6e83f605
equal deleted inserted replaced
1451:65bdd7da65f7 1453:2be886c8cffb
1320 """ preferences will be written to disc.</p>""" 1320 """ preferences will be written to disc.</p>"""
1321 )) 1321 ))
1322 self.exitAct.triggered[()].connect(self.__quit) 1322 self.exitAct.triggered[()].connect(self.__quit)
1323 self.actions.append(self.exitAct) 1323 self.actions.append(self.exitAct)
1324 1324
1325 self.newWindowAct = E5Action(self.trUtf8('New Window'),
1326 UI.PixmapCache.getIcon("newWindow.png"),
1327 self.trUtf8('New &Window'),
1328 QKeySequence(self.trUtf8("Ctrl+Shift+N", "File|New Window")),
1329 0, self, 'new_window')
1330 self.newWindowAct.setStatusTip(self.trUtf8('Open a new eric5 instance'))
1331 self.newWindowAct.setWhatsThis(self.trUtf8(
1332 """<b>New Window</b>"""
1333 """<p>This opens a new instance of the eric5 IDE.</p>"""
1334 ))
1335 self.newWindowAct.triggered[()].connect(self.__newWindow)
1336 self.actions.append(self.newWindowAct)
1337 self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode"))
1338
1325 self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True) 1339 self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True)
1326 1340
1327 self.setEditProfileAct = E5Action(self.trUtf8('Edit Profile'), 1341 self.setEditProfileAct = E5Action(self.trUtf8('Edit Profile'),
1328 UI.PixmapCache.getIcon("viewProfileEdit.png"), 1342 UI.PixmapCache.getIcon("viewProfileEdit.png"),
1329 self.trUtf8('Edit Profile'), 1343 self.trUtf8('Edit Profile'),
2253 self.__menus["file"] = self.viewmanager.initFileMenu() 2267 self.__menus["file"] = self.viewmanager.initFileMenu()
2254 mb.addMenu(self.__menus["file"]) 2268 mb.addMenu(self.__menus["file"])
2255 self.__menus["file"].addSeparator() 2269 self.__menus["file"].addSeparator()
2256 self.__menus["file"].addAction(self.exitAct) 2270 self.__menus["file"].addAction(self.exitAct)
2257 self.__menus["file"].aboutToShow.connect(self.__showFileMenu) 2271 self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
2272 act = self.__menus["file"].actions()[0]
2273 sep = self.__menus["file"].insertSeparator(act)
2274 self.__menus["file"].insertAction(sep, self.newWindowAct)
2258 2275
2259 self.__menus["edit"] = self.viewmanager.initEditMenu() 2276 self.__menus["edit"] = self.viewmanager.initEditMenu()
2260 mb.addMenu(self.__menus["edit"]) 2277 mb.addMenu(self.__menus["edit"])
2261 2278
2262 self.__menus["view"] = self.viewmanager.initViewMenu() 2279 self.__menus["view"] = self.viewmanager.initViewMenu()
2425 pluginstb.setToolTip(self.trUtf8("Plugins")) 2442 pluginstb.setToolTip(self.trUtf8("Plugins"))
2426 2443
2427 filetb.addSeparator() 2444 filetb.addSeparator()
2428 filetb.addAction(self.exitAct) 2445 filetb.addAction(self.exitAct)
2429 self.toolbarManager.addToolBar(filetb, filetb.windowTitle()) 2446 self.toolbarManager.addToolBar(filetb, filetb.windowTitle())
2447 act = self.__menus["file"].actions()[0]
2448 sep = filetb.insertSeparator(act)
2449 filetb.insertAction(sep, self.newWindowAct)
2430 2450
2431 # setup the unittest toolbar 2451 # setup the unittest toolbar
2432 unittesttb.addAction(self.utDialogAct) 2452 unittesttb.addAction(self.utDialogAct)
2433 unittesttb.addSeparator() 2453 unittesttb.addSeparator()
2434 unittesttb.addAction(self.utRestartAct) 2454 unittesttb.addAction(self.utRestartAct)
3076 program = sys.executable 3096 program = sys.executable
3077 eric5 = os.path.join(getConfig("ericDir"), "eric5.py") 3097 eric5 = os.path.join(getConfig("ericDir"), "eric5.py")
3078 args = [eric5] 3098 args = [eric5]
3079 args.append("--start-session") 3099 args.append("--start-session")
3080 args.extend(self.__restartArgs) 3100 args.extend(self.__restartArgs)
3101 QProcess.startDetached(program, args)
3102
3103 def __newWindow(self):
3104 """
3105 Private slot to start a new instance of eric5.
3106 """
3107 if not Preferences.getUI("SingleApplicationMode"):
3108 # start eric5 without any arguments
3109 program = sys.executable
3110 eric5 = os.path.join(getConfig("ericDir"), "eric5.py")
3111 args = [eric5]
3081 QProcess.startDetached(program, args) 3112 QProcess.startDetached(program, args)
3082 3113
3083 def __showToolsMenu(self): 3114 def __showToolsMenu(self):
3084 """ 3115 """
3085 Private slot to display the Tools menu. 3116 Private slot to display the Tools menu.
4963 self.SAServer = E5SingleApplicationServer() 4994 self.SAServer = E5SingleApplicationServer()
4964 else: 4995 else:
4965 if self.SAServer is not None: 4996 if self.SAServer is not None:
4966 self.SAServer.shutdown() 4997 self.SAServer.shutdown()
4967 self.SAServer = None 4998 self.SAServer = None
4999 self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode"))
4968 5000
4969 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") 5001 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
4970 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") 5002 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename")
4971 if not self.captionShowsFilename: 5003 if not self.captionShowsFilename:
4972 self.__setWindowCaption(editor="") 5004 self.__setWindowCaption(editor="")

eric ide

mercurial