Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 4298
4e7a0e2c20fc
parent 4025
ffc69fe3a61d
child 4344
d096b2c767d8
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Fri Jun 26 18:34:11 2015 +0200
+++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Fri Jun 26 19:21:16 2015 +0200
@@ -856,20 +856,26 @@
             self.changeCaption.emit("")
         self.editorChangedEd.emit(aw)
         
-    def _addView(self, win, fn=None, noName=""):
+    def _addView(self, win, fn=None, noName="", next=False):
         """
         Protected method to add a view (i.e. window).
         
         @param win editor assembly to be added
         @param fn filename of this editor (string)
         @param noName name to be used for an unnamed editor (string)
+        @param next flag indicating to add the view next to the current
+            view (bool)
         """
         editor = win.getEditor()
         if fn is None:
             if not noName:
                 self.untitledCount += 1
                 noName = self.tr("Untitled {0}").format(self.untitledCount)
-            self.currentTabWidget.addTab(win, noName)
+            if next:
+                index = self.currentTabWidget.currentIndex() + 1
+                self.currentTabWidget.insertWidget(index, win, noName)
+            else:
+                self.currentTabWidget.addTab(win, noName)
             editor.setNoName(noName)
         else:
             if self.filenameOnly:
@@ -880,7 +886,11 @@
                 txt = "...{0}".format(txt[-self.maxFileNameChars:])
             if not QFileInfo(fn).isWritable():
                 txt = self.tr("{0} (ro)").format(txt)
-            self.currentTabWidget.addTab(win, txt)
+            if next:
+                index = self.currentTabWidget.currentIndex() + 1
+                self.currentTabWidget.insertWidget(index, win, txt)
+            else:
+                self.currentTabWidget.addTab(win, txt)
             index = self.currentTabWidget.indexOf(win)
             self.currentTabWidget.setTabToolTip(index, fn)
         self.currentTabWidget.setCurrentWidget(win)

eric ide

mercurial