Added an action to launch another instantiation of eric5.

Sat, 19 Nov 2011 15:47:01 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 19 Nov 2011 15:47:01 +0100
changeset 1453
2be886c8cffb
parent 1451
65bdd7da65f7
child 1454
c32c27988379

Added an action to launch another instantiation of eric5.

UI/UserInterface.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
--- a/UI/UserInterface.py	Sat Nov 19 15:39:25 2011 +0100
+++ b/UI/UserInterface.py	Sat Nov 19 15:47:01 2011 +0100
@@ -1322,6 +1322,20 @@
         self.exitAct.triggered[()].connect(self.__quit)
         self.actions.append(self.exitAct)
 
+        self.newWindowAct = E5Action(self.trUtf8('New Window'),
+                UI.PixmapCache.getIcon("newWindow.png"),
+                self.trUtf8('New &Window'),
+                QKeySequence(self.trUtf8("Ctrl+Shift+N", "File|New Window")),
+                0, self, 'new_window')
+        self.newWindowAct.setStatusTip(self.trUtf8('Open a new eric5 instance'))
+        self.newWindowAct.setWhatsThis(self.trUtf8(
+            """<b>New Window</b>"""
+            """<p>This opens a new instance of the eric5 IDE.</p>"""
+        ))
+        self.newWindowAct.triggered[()].connect(self.__newWindow)
+        self.actions.append(self.newWindowAct)
+        self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode"))
+        
         self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True)
         
         self.setEditProfileAct = E5Action(self.trUtf8('Edit Profile'),
@@ -2255,6 +2269,9 @@
         self.__menus["file"].addSeparator()
         self.__menus["file"].addAction(self.exitAct)
         self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
+        act = self.__menus["file"].actions()[0]
+        sep = self.__menus["file"].insertSeparator(act)
+        self.__menus["file"].insertAction(sep, self.newWindowAct)
         
         self.__menus["edit"] = self.viewmanager.initEditMenu()
         mb.addMenu(self.__menus["edit"])
@@ -2427,6 +2444,9 @@
         filetb.addSeparator()
         filetb.addAction(self.exitAct)
         self.toolbarManager.addToolBar(filetb, filetb.windowTitle())
+        act = self.__menus["file"].actions()[0]
+        sep = filetb.insertSeparator(act)
+        filetb.insertAction(sep, self.newWindowAct)
         
         # setup the unittest toolbar
         unittesttb.addAction(self.utDialogAct)
@@ -3080,6 +3100,17 @@
             args.extend(self.__restartArgs)
             QProcess.startDetached(program, args)
         
+    def __newWindow(self):
+        """
+        Private slot to start a new instance of eric5.
+        """
+        if not Preferences.getUI("SingleApplicationMode"):
+            # start eric5 without any arguments
+            program = sys.executable
+            eric5 = os.path.join(getConfig("ericDir"), "eric5.py")
+            args = [eric5]
+            QProcess.startDetached(program, args)
+        
     def __showToolsMenu(self):
         """
         Private slot to display the Tools menu.
@@ -4965,6 +4996,7 @@
             if self.SAServer is not None:
                 self.SAServer.shutdown()
                 self.SAServer = None
+        self.newWindowAct.setEnabled(not Preferences.getUI("SingleApplicationMode"))
         
         self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
         self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename")
--- a/changelog	Sat Nov 19 15:39:25 2011 +0100
+++ b/changelog	Sat Nov 19 15:47:01 2011 +0100
@@ -51,6 +51,8 @@
 - enhancements of the tasks manager
   -- made tasks manager forget about global file tasks when file is closed
      (configurable via configuration dialog)
+- other enhancements
+  -- added an action to launch another instantiation of eric5
 
 Version 5.2-snapshot-20110724:
 - bug fixes

eric ide

mercurial