Fri, 26 Jun 2015 19:21:16 +0200
Extended the viewmanager interface to allow to open a new editor next to the current one.
--- a/APIs/Python3/eric6.api Fri Jun 26 18:34:11 2015 +0200 +++ b/APIs/Python3/eric6.api Fri Jun 26 19:21:16 2015 +0200 @@ -5689,7 +5689,7 @@ eric6.Plugins.VcsPlugins.vcsSubversion.subversion.Subversion.vcsTag?4(name) eric6.Plugins.VcsPlugins.vcsSubversion.subversion.Subversion.vcsUpdate?4(name, noDialog=False) eric6.Plugins.VcsPlugins.vcsSubversion.subversion.Subversion?1(plugin, parent=None, name=None) -eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace._addView?5(win, fn=None, noName="") +eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace._addView?5(win, fn=None, noName="", next=False) eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace._initWindowActions?5() eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace._modificationStatusChanged?5(m, editor) eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace._removeAllViews?5() @@ -5762,7 +5762,7 @@ eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.setCurrentWidget?4(assembly) eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.showIndicator?4(on) eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget?1(vm) -eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.Tabview._addView?5(win, fn=None, noName="") +eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.Tabview._addView?5(win, fn=None, noName="", next=False) eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.Tabview._initWindowActions?5() eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.Tabview._modificationStatusChanged?5(m, editor) eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.Tabview._removeAllViews?5() @@ -8999,7 +8999,7 @@ eric6.ViewManager.ViewManager.QuickSearchLineEdit.focusInEvent?4(evt) eric6.ViewManager.ViewManager.QuickSearchLineEdit.gotFocus?7 eric6.ViewManager.ViewManager.QuickSearchLineEdit.keyPressEvent?4(evt) -eric6.ViewManager.ViewManager.ViewManager._addView?5(win, fn=None, noName="") +eric6.ViewManager.ViewManager.ViewManager._addView?5(win, fn=None, noName="", next=False) eric6.ViewManager.ViewManager.ViewManager._checkActions?5(editor, setSb=True) eric6.ViewManager.ViewManager.ViewManager._getOpenFileFilter?5() eric6.ViewManager.ViewManager.ViewManager._getOpenStartDir?5() @@ -9053,7 +9053,7 @@ eric6.ViewManager.ViewManager.ViewManager.getAPIsManager?4() eric6.ViewManager.ViewManager.ViewManager.getActions?4(type) eric6.ViewManager.ViewManager.ViewManager.getActiveName?4() -eric6.ViewManager.ViewManager.ViewManager.getEditor?4(fn, filetype="") +eric6.ViewManager.ViewManager.ViewManager.getEditor?4(fn, filetype="", next=False) eric6.ViewManager.ViewManager.ViewManager.getMostRecent?4() eric6.ViewManager.ViewManager.ViewManager.getNumber?4() eric6.ViewManager.ViewManager.ViewManager.getOpenEditor?4(fn) @@ -9084,7 +9084,7 @@ eric6.ViewManager.ViewManager.ViewManager.newEditorView?4(fn, caller, filetype="") eric6.ViewManager.ViewManager.ViewManager.nextSplit?4() eric6.ViewManager.ViewManager.ViewManager.openFiles?4(prog) -eric6.ViewManager.ViewManager.ViewManager.openSourceFile?4(fn, lineno=-1, filetype="", selStart=0, selEnd=0, pos=0) +eric6.ViewManager.ViewManager.ViewManager.openSourceFile?4(fn, lineno=-1, filetype="", selStart=0, selEnd=0, pos=0, next=False) eric6.ViewManager.ViewManager.ViewManager.preferencesChanged?4() eric6.ViewManager.ViewManager.ViewManager.prevSplit?4() eric6.ViewManager.ViewManager.ViewManager.previewStateChanged?7
--- a/Documentation/Source/eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.html Fri Jun 26 18:34:11 2015 +0200 +++ b/Documentation/Source/eric6.Plugins.ViewManagerPlugins.Listspace.Listspace.html Fri Jun 26 19:21:16 2015 +0200 @@ -372,7 +372,7 @@ </dd> </dl><a NAME="Listspace._addView" ID="Listspace._addView"></a> <h4>Listspace._addView</h4> -<b>_addView</b>(<i>win, fn=None, noName=""</i>) +<b>_addView</b>(<i>win, fn=None, noName="", next=False</i>) <p> Protected method to add a view (i.e. window). </p><dl> @@ -385,6 +385,10 @@ </dd><dt><i>noName</i></dt> <dd> name to be used for an unnamed editor (string) +</dd><dt><i>next</i></dt> +<dd> +flag indicating to add the view next to the current + view (bool) </dd> </dl><a NAME="Listspace._initWindowActions" ID="Listspace._initWindowActions"></a> <h4>Listspace._initWindowActions</h4>
--- a/Documentation/Source/eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.html Fri Jun 26 18:34:11 2015 +0200 +++ b/Documentation/Source/eric6.Plugins.ViewManagerPlugins.Tabview.Tabview.html Fri Jun 26 19:21:16 2015 +0200 @@ -811,7 +811,7 @@ </dd> </dl><a NAME="Tabview._addView" ID="Tabview._addView"></a> <h4>Tabview._addView</h4> -<b>_addView</b>(<i>win, fn=None, noName=""</i>) +<b>_addView</b>(<i>win, fn=None, noName="", next=False</i>) <p> Protected method to add a view (i.e. window). </p><dl> @@ -824,6 +824,10 @@ </dd><dt><i>noName</i></dt> <dd> name to be used for an unnamed editor (string) +</dd><dt><i>next</i></dt> +<dd> +flag indicating to add the view next to the current + view (bool) </dd> </dl><a NAME="Tabview._initWindowActions" ID="Tabview._initWindowActions"></a> <h4>Tabview._initWindowActions</h4>
--- a/Documentation/Source/eric6.ViewManager.ViewManager.html Fri Jun 26 18:34:11 2015 +0200 +++ b/Documentation/Source/eric6.ViewManager.ViewManager.html Fri Jun 26 19:21:16 2015 +0200 @@ -1870,7 +1870,7 @@ </dd> </dl><a NAME="ViewManager._addView" ID="ViewManager._addView"></a> <h4>ViewManager._addView</h4> -<b>_addView</b>(<i>win, fn=None, noName=""</i>) +<b>_addView</b>(<i>win, fn=None, noName="", next=False</i>) <p> Protected method to add a view (i.e. window). </p><dl> @@ -1883,6 +1883,10 @@ </dd><dt><i>noName</i></dt> <dd> name to be used for an unnamed editor (string) +</dd><dt><i>next</i></dt> +<dd> +flag indicating to add the view next to the current + view (bool) </dd> </dl><dl> <dt>Raises <b>RuntimeError</b>:</dt> @@ -2331,7 +2335,7 @@ </dd> </dl><a NAME="ViewManager.getEditor" ID="ViewManager.getEditor"></a> <h4>ViewManager.getEditor</h4> -<b>getEditor</b>(<i>fn, filetype=""</i>) +<b>getEditor</b>(<i>fn, filetype="", next=False</i>) <p> Public method to return the editor displaying the given file. </p><p> @@ -2344,6 +2348,10 @@ </dd><dt><i>filetype</i></dt> <dd> type of the source file (string) +</dd><dt><i>next</i></dt> +<dd> +flag indicating that if a new editor needs to be created, + it should be added next to the current editor (bool) </dd> </dl><dl> <dt>Returns:</dt> @@ -2682,7 +2690,7 @@ </dd> </dl><a NAME="ViewManager.openSourceFile" ID="ViewManager.openSourceFile"></a> <h4>ViewManager.openSourceFile</h4> -<b>openSourceFile</b>(<i>fn, lineno=-1, filetype="", selStart=0, selEnd=0, pos=0</i>) +<b>openSourceFile</b>(<i>fn, lineno=-1, filetype="", selStart=0, selEnd=0, pos=0, next=False</i>) <p> Public slot to display a file in an editor. </p><dl> @@ -2706,6 +2714,10 @@ </dd><dt><i>pos</i></dt> <dd> position within the line to place the cursor at (integer) +</dd><dt><i>next</i></dt> +<dd> +flag indicating to add the file next to the current + editor (bool) </dd> </dl><a NAME="ViewManager.preferencesChanged" ID="ViewManager.preferencesChanged"></a> <h4>ViewManager.preferencesChanged</h4>
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py Fri Jun 26 18:34:11 2015 +0200 +++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py Fri Jun 26 19:21:16 2015 +0200 @@ -379,13 +379,15 @@ 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:
--- 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)
--- a/ViewManager/ViewManager.py Fri Jun 26 18:34:11 2015 +0200 +++ b/ViewManager/ViewManager.py Fri Jun 26 19:21:16 2015 +0200 @@ -384,13 +384,15 @@ """ raise RuntimeError('Not implemented') - 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 @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) @exception RuntimeError Not implemented """ raise RuntimeError('Not implemented') @@ -4406,7 +4408,7 @@ self.__setSbFile() def openSourceFile(self, fn, lineno=-1, filetype="", - selStart=0, selEnd=0, pos=0): + selStart=0, selEnd=0, pos=0, next=False): """ Public slot to display a file in an editor. @@ -4418,9 +4420,11 @@ @param selStart start of an area to be selected (integer) @param selEnd end of an area to be selected (integer) @param pos position within the line to place the cursor at (integer) + @param next flag indicating to add the file next to the current + editor (bool) """ try: - newWin, editor = self.getEditor(fn, filetype=filetype) + newWin, editor = self.getEditor(fn, filetype=filetype, next=next) except (IOError, UnicodeDecodeError): return @@ -4704,7 +4708,7 @@ return filenames - def getEditor(self, fn, filetype=""): + def getEditor(self, fn, filetype="", next=False): """ Public method to return the editor displaying the given file. @@ -4713,6 +4717,8 @@ @param fn filename to look for @param filetype type of the source file (string) + @param next flag indicating that if a new editor needs to be created, + it should be added next to the current editor (bool) @return tuple of two values giving a flag indicating a new window creation and a reference to the editor displaying this file """ @@ -4736,7 +4742,7 @@ newWin = True if newWin: - self._addView(assembly, fn) + self._addView(assembly, fn, next=next) else: self._showView(editor.parent(), fn)