Fri, 04 Nov 2011 13:26:01 +0100
Fixed a few issues related to the new editor assembly and to drag&drop of tabs.
--- a/APIs/Python3/eric5.api Thu Nov 03 17:52:13 2011 +0100 +++ b/APIs/Python3/eric5.api Fri Nov 04 13:26:01 2011 +0100 @@ -4254,7 +4254,7 @@ eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace.syntaxerrorToggled?7 eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace.tile?4() eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.Listspace?1(parent) -eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.StackedWidget.addWidget?4(editor) +eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.StackedWidget.addWidget?4(assembly) eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.StackedWidget.currentWidget?4() eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.StackedWidget.firstEditor?4() eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.StackedWidget.hasEditor?4(editor) @@ -4272,16 +4272,13 @@ eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabBar.tabMoveRequested?7 eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabBar.tabRelocateRequested?7 eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabBar?1(parent=None) -eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.addTab?4(editor, title) -eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.copyTab?4(sourceIndex, targetIndex) -eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.copyTabOther?4(sourceId, sourceIndex, targetIndex) +eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.addTab?4(assembly, title) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.currentWidget?4() eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.hasEditor?4(editor) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.hasEditors?4() eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.indexOf?4(object) -eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.insertWidget?4(index, editor, title) +eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.insertWidget?4(index, assembly, title) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.mouseDoubleClickEvent?4(event) -eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.relocateTab?4(sourceId, sourceIndex, targetIndex) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.removeWidget?4(object) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.setCurrentWidget?4(editor) eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.TabWidget.showIndicator?4(on)
--- a/Documentation/Help/source.qhp Thu Nov 03 17:52:13 2011 +0100 +++ b/Documentation/Help/source.qhp Fri Nov 04 13:26:01 2011 +0100 @@ -9849,20 +9849,20 @@ <keyword name="TabWidget.__contextMenuSave" id="TabWidget.__contextMenuSave" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__contextMenuSave" /> <keyword name="TabWidget.__contextMenuSaveAll" id="TabWidget.__contextMenuSaveAll" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__contextMenuSaveAll" /> <keyword name="TabWidget.__contextMenuSaveAs" id="TabWidget.__contextMenuSaveAs" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__contextMenuSaveAs" /> + <keyword name="TabWidget.__copyTab" id="TabWidget.__copyTab" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__copyTab" /> + <keyword name="TabWidget.__copyTabOther" id="TabWidget.__copyTabOther" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__copyTabOther" /> <keyword name="TabWidget.__initMenu" id="TabWidget.__initMenu" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__initMenu" /> <keyword name="TabWidget.__navigationMenuTriggered" id="TabWidget.__navigationMenuTriggered" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__navigationMenuTriggered" /> + <keyword name="TabWidget.__relocateTab" id="TabWidget.__relocateTab" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__relocateTab" /> <keyword name="TabWidget.__showContextMenu" id="TabWidget.__showContextMenu" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__showContextMenu" /> <keyword name="TabWidget.__showNavigationMenu" id="TabWidget.__showNavigationMenu" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.__showNavigationMenu" /> <keyword name="TabWidget.addTab" id="TabWidget.addTab" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.addTab" /> - <keyword name="TabWidget.copyTab" id="TabWidget.copyTab" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.copyTab" /> - <keyword name="TabWidget.copyTabOther" id="TabWidget.copyTabOther" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.copyTabOther" /> <keyword name="TabWidget.currentWidget" id="TabWidget.currentWidget" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.currentWidget" /> <keyword name="TabWidget.hasEditor" id="TabWidget.hasEditor" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.hasEditor" /> <keyword name="TabWidget.hasEditors" id="TabWidget.hasEditors" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.hasEditors" /> <keyword name="TabWidget.indexOf" id="TabWidget.indexOf" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.indexOf" /> <keyword name="TabWidget.insertWidget" id="TabWidget.insertWidget" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.insertWidget" /> <keyword name="TabWidget.mouseDoubleClickEvent" id="TabWidget.mouseDoubleClickEvent" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.mouseDoubleClickEvent" /> - <keyword name="TabWidget.relocateTab" id="TabWidget.relocateTab" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.relocateTab" /> <keyword name="TabWidget.removeWidget" id="TabWidget.removeWidget" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.removeWidget" /> <keyword name="TabWidget.setCurrentWidget" id="TabWidget.setCurrentWidget" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.setCurrentWidget" /> <keyword name="TabWidget.showIndicator" id="TabWidget.showIndicator" ref="eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html#TabWidget.showIndicator" />
--- a/Documentation/Source/eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.html Thu Nov 03 17:52:13 2011 +0100 +++ b/Documentation/Source/eric5.Plugins.ViewManagerPlugins.Listspace.Listspace.html Fri Nov 04 13:26:01 2011 +0100 @@ -321,7 +321,7 @@ </p><dl> <dt><i>win</i></dt> <dd> -editor window to be added +editor assembly to be added </dd><dt><i>fn</i></dt> <dd> filename of this editor (string) @@ -580,13 +580,14 @@ </dd> </dl><a NAME="StackedWidget.addWidget" ID="StackedWidget.addWidget"></a> <h4>StackedWidget.addWidget</h4> -<b>addWidget</b>(<i>editor</i>) +<b>addWidget</b>(<i>assembly</i>) <p> Overwritten method to add a new widget. </p><dl> -<dt><i>editor</i></dt> +<dt><i>assembly</i></dt> <dd> -the editor object to be added (QScintilla.Editor.Editor) +editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) </dd> </dl><a NAME="StackedWidget.currentWidget" ID="StackedWidget.currentWidget"></a> <h4>StackedWidget.currentWidget</h4>
--- a/Documentation/Source/eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html Thu Nov 03 17:52:13 2011 +0100 +++ b/Documentation/Source/eric5.Plugins.ViewManagerPlugins.Tabview.Tabview.html Fri Nov 04 13:26:01 2011 +0100 @@ -56,20 +56,20 @@ <dd> emitted to signal a clone request giving the old and new index position -</dd><dt>tabCopyRequested(long, int, int)</dt> +</dd><dt>tabCopyRequested(str, int, int)</dt> <dd> emitted to signal a clone request - giving the id of the source tab widget, the index in the source tab widget - and the new index position + giving the string encoded id of the source tab widget, the index in the + source tab widget and the new index position </dd><dt>tabMoveRequested(int, int)</dt> <dd> emitted to signal a tab move request giving the old and new index position -</dd><dt>tabRelocateRequested(long, int, int)</dt> +</dd><dt>tabRelocateRequested(str, int, int)</dt> <dd> emitted to signal a tab relocation - request giving the id of the old tab widget, the index in the old tab widget - and the new index position + request giving the string encoded id of the old tab widget, the index in + the old tab widget and the new index position </dd> </dl> <h3>Derived from</h3> @@ -227,12 +227,21 @@ <td><a href="#TabWidget.__contextMenuSaveAs">__contextMenuSaveAs</a></td> <td>Private method to save the selected tab to a new file.</td> </tr><tr> +<td><a href="#TabWidget.__copyTab">__copyTab</a></td> +<td>Private method to copy an editor.</td> +</tr><tr> +<td><a href="#TabWidget.__copyTabOther">__copyTabOther</a></td> +<td>Private method to copy an editor from another TabWidget.</td> +</tr><tr> <td><a href="#TabWidget.__initMenu">__initMenu</a></td> <td>Private method to initialize the tab context menu.</td> </tr><tr> <td><a href="#TabWidget.__navigationMenuTriggered">__navigationMenuTriggered</a></td> <td>Private slot called to handle the navigation button menu selection.</td> </tr><tr> +<td><a href="#TabWidget.__relocateTab">__relocateTab</a></td> +<td>Private method to relocate an editor from another TabWidget.</td> +</tr><tr> <td><a href="#TabWidget.__showContextMenu">__showContextMenu</a></td> <td>Private slot to show the tab context menu.</td> </tr><tr> @@ -242,12 +251,6 @@ <td><a href="#TabWidget.addTab">addTab</a></td> <td>Overwritten method to add a new tab.</td> </tr><tr> -<td><a href="#TabWidget.copyTab">copyTab</a></td> -<td>Public method to copy an editor.</td> -</tr><tr> -<td><a href="#TabWidget.copyTabOther">copyTabOther</a></td> -<td>Public method to copy an editor from another TabWidget.</td> -</tr><tr> <td><a href="#TabWidget.currentWidget">currentWidget</a></td> <td>Overridden method to return a reference to the current page.</td> </tr><tr> @@ -266,9 +269,6 @@ <td><a href="#TabWidget.mouseDoubleClickEvent">mouseDoubleClickEvent</a></td> <td>Protected method handling double click events.</td> </tr><tr> -<td><a href="#TabWidget.relocateTab">relocateTab</a></td> -<td>Public method to relocate an editor from another TabWidget.</td> -</tr><tr> <td><a href="#TabWidget.removeWidget">removeWidget</a></td> <td>Public method to remove a widget.</td> </tr><tr> @@ -388,7 +388,36 @@ <b>__contextMenuSaveAs</b>(<i></i>) <p> Private method to save the selected tab to a new file. -</p><a NAME="TabWidget.__initMenu" ID="TabWidget.__initMenu"></a> +</p><a NAME="TabWidget.__copyTab" ID="TabWidget.__copyTab"></a> +<h4>TabWidget.__copyTab</h4> +<b>__copyTab</b>(<i>sourceIndex, targetIndex</i>) +<p> + Private method to copy an editor. +</p><dl> +<dt><i>sourceIndex</i></dt> +<dd> +index of the tab (integer) +</dd><dt><i>targetIndex</i></dt> +<dd> +index position to place it to (integer) +</dd> +</dl><a NAME="TabWidget.__copyTabOther" ID="TabWidget.__copyTabOther"></a> +<h4>TabWidget.__copyTabOther</h4> +<b>__copyTabOther</b>(<i>sourceId, sourceIndex, targetIndex</i>) +<p> + Private method to copy an editor from another TabWidget. +</p><dl> +<dt><i>sourceId</i></dt> +<dd> +id of the TabWidget to get the editor from (string) +</dd><dt><i>sourceIndex</i></dt> +<dd> +index of the tab in the old tab widget (integer) +</dd><dt><i>targetIndex</i></dt> +<dd> +index position to place it to (integer) +</dd> +</dl><a NAME="TabWidget.__initMenu" ID="TabWidget.__initMenu"></a> <h4>TabWidget.__initMenu</h4> <b>__initMenu</b>(<i></i>) <p> @@ -403,6 +432,22 @@ <dd> reference to the selected action (QAction) </dd> +</dl><a NAME="TabWidget.__relocateTab" ID="TabWidget.__relocateTab"></a> +<h4>TabWidget.__relocateTab</h4> +<b>__relocateTab</b>(<i>sourceId, sourceIndex, targetIndex</i>) +<p> + Private method to relocate an editor from another TabWidget. +</p><dl> +<dt><i>sourceId</i></dt> +<dd> +id of the TabWidget to get the editor from (string) +</dd><dt><i>sourceIndex</i></dt> +<dd> +index of the tab in the old tab widget (integer) +</dd><dt><i>targetIndex</i></dt> +<dd> +index position to place it to (integer) +</dd> </dl><a NAME="TabWidget.__showContextMenu" ID="TabWidget.__showContextMenu"></a> <h4>TabWidget.__showContextMenu</h4> <b>__showContextMenu</b>(<i>coord, index</i>) @@ -423,46 +468,18 @@ Private slot to show the navigation button menu. </p><a NAME="TabWidget.addTab" ID="TabWidget.addTab"></a> <h4>TabWidget.addTab</h4> -<b>addTab</b>(<i>editor, title</i>) +<b>addTab</b>(<i>assembly, title</i>) <p> Overwritten method to add a new tab. </p><dl> -<dt><i>editor</i></dt> +<dt><i>assembly</i></dt> <dd> -the editor object to be added (QScintilla.Editor.Editor) +editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) </dd><dt><i>title</i></dt> <dd> title for the new tab (string) </dd> -</dl><a NAME="TabWidget.copyTab" ID="TabWidget.copyTab"></a> -<h4>TabWidget.copyTab</h4> -<b>copyTab</b>(<i>sourceIndex, targetIndex</i>) -<p> - Public method to copy an editor. -</p><dl> -<dt><i>sourceIndex</i></dt> -<dd> -index of the tab (integer) -</dd><dt><i>targetIndex</i></dt> -<dd> -index position to place it to (integer) -</dd> -</dl><a NAME="TabWidget.copyTabOther" ID="TabWidget.copyTabOther"></a> -<h4>TabWidget.copyTabOther</h4> -<b>copyTabOther</b>(<i>sourceId, sourceIndex, targetIndex</i>) -<p> - Public method to copy an editor from another TabWidget. -</p><dl> -<dt><i>sourceId</i></dt> -<dd> -id of the TabWidget to get the editor from (long) -</dd><dt><i>sourceIndex</i></dt> -<dd> -index of the tab in the old tab widget (integer) -</dd><dt><i>targetIndex</i></dt> -<dd> -index position to place it to (integer) -</dd> </dl><a NAME="TabWidget.currentWidget" ID="TabWidget.currentWidget"></a> <h4>TabWidget.currentWidget</h4> <b>currentWidget</b>(<i></i>) @@ -516,16 +533,17 @@ </dd> </dl><a NAME="TabWidget.insertWidget" ID="TabWidget.insertWidget"></a> <h4>TabWidget.insertWidget</h4> -<b>insertWidget</b>(<i>index, editor, title</i>) +<b>insertWidget</b>(<i>index, assembly, title</i>) <p> Overwritten method to insert a new tab. </p><dl> <dt><i>index</i></dt> <dd> index position for the new tab (integer) -</dd><dt><i>editor</i></dt> +</dd><dt><i>assembly</i></dt> <dd> -the editor object to be added (QScintilla.Editor.Editor) +editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) </dd><dt><i>title</i></dt> <dd> title for the new tab (string) @@ -545,22 +563,6 @@ <dd> reference to the event object (QMouseEvent) </dd> -</dl><a NAME="TabWidget.relocateTab" ID="TabWidget.relocateTab"></a> -<h4>TabWidget.relocateTab</h4> -<b>relocateTab</b>(<i>sourceId, sourceIndex, targetIndex</i>) -<p> - Public method to relocate an editor from another TabWidget. -</p><dl> -<dt><i>sourceId</i></dt> -<dd> -id of the TabWidget to get the editor from (long) -</dd><dt><i>sourceIndex</i></dt> -<dd> -index of the tab in the old tab widget (integer) -</dd><dt><i>targetIndex</i></dt> -<dd> -index position to place it to (integer) -</dd> </dl><a NAME="TabWidget.removeWidget" ID="TabWidget.removeWidget"></a> <h4>TabWidget.removeWidget</h4> <b>removeWidget</b>(<i>object</i>) @@ -770,7 +772,7 @@ </p><dl> <dt><i>win</i></dt> <dd> -editor window to be added +editor assembly to be added </dd><dt><i>fn</i></dt> <dd> filename of this editor (string) @@ -925,7 +927,7 @@ </p><dl> <dt><i>win</i></dt> <dd> -editor window to be added +editor assembly to be inserted </dd><dt><i>tabWidget</i></dt> <dd> reference to the tab widget to insert the editor into (TabWidget)
--- a/Documentation/Source/eric5.ViewManager.ViewManager.html Thu Nov 03 17:52:13 2011 +0100 +++ b/Documentation/Source/eric5.ViewManager.ViewManager.html Fri Nov 04 13:26:01 2011 +0100 @@ -1526,7 +1526,7 @@ </p><dl> <dt><i>win</i></dt> <dd> -editor window to be added +editor assembly to be added </dd><dt><i>fn</i></dt> <dd> filename of this editor @@ -1816,7 +1816,8 @@ </dl><dl> <dt>Returns:</dt> <dd> -reference to the new editor object (Editor.Editor) +reference to the new editor object (Editor.Editor) and the new + edito assembly object (EditorAssembly.EditorAssembly) </dd> </dl><a NAME="ViewManager.closeAllWindows" ID="ViewManager.closeAllWindows"></a> <h4>ViewManager.closeAllWindows</h4>
--- a/E5Gui/E5TabWidget.py Thu Nov 03 17:52:13 2011 +0100 +++ b/E5Gui/E5TabWidget.py Fri Nov 04 13:26:01 2011 +0100 @@ -85,7 +85,7 @@ index = self.tabAt(event.pos()) mimeData.setText(self.tabText(index)) mimeData.setData("action", "tab-reordering") - mimeData.setData("tabbar-id", QByteArray.number(id(self))) + mimeData.setData("tabbar-id", str(id(self))) drag.setMimeData(mimeData) drag.exec_() E5WheelTabBar.mouseMoveEvent(self, event) @@ -101,7 +101,7 @@ if "action" in formats and \ mimeData.data("action") == "tab-reordering" and \ "tabbar-id" in formats and \ - mimeData.data("tabbar-id") == id(self): + int(mimeData.data("tabbar-id")) == id(self): event.acceptProposedAction() E5WheelTabBar.dragEnterEvent(self, event)
--- a/Plugins/ViewManagerPlugins/Listspace/Listspace.py Thu Nov 03 17:52:13 2011 +0100 +++ b/Plugins/ViewManagerPlugins/Listspace/Listspace.py Fri Nov 04 13:26:01 2011 +0100 @@ -36,13 +36,15 @@ self.editors = [] - def addWidget(self, editor): + def addWidget(self, assembly): """ Overwritten method to add a new widget. - @param editor the editor object to be added (QScintilla.Editor.Editor) + @param assembly editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) """ - super().addWidget(editor.parent()) + editor = assembly.getEditor() + super().addWidget(assembly) if not editor in self.editors: self.editors.append(editor) @@ -337,16 +339,17 @@ """ Protected method to add a view (i.e. window) - @param win editor window to be added + @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) """ + editor = win.getEditor() if fn is None: if not noName: self.untitledCount += 1 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) self.viewlist.addItem(noName) - win.setNoName(noName) + editor.setNoName(noName) else: txt = os.path.basename(fn) if not QFileInfo(fn).isWritable(): @@ -360,7 +363,7 @@ index = self.editors.index(win) self.viewlist.setCurrentRow(index) - win.setFocus() + editor.setFocus() if fn: self.changeCaption.emit(fn) self.editorChanged.emit(fn)
--- a/Plugins/ViewManagerPlugins/Tabview/Tabview.py Thu Nov 03 17:52:13 2011 +0100 +++ b/Plugins/ViewManagerPlugins/Tabview/Tabview.py Fri Nov 04 13:26:01 2011 +0100 @@ -36,19 +36,18 @@ @signal tabMoveRequested(int, int) emitted to signal a tab move request giving the old and new index position - @signal tabRelocateRequested(long, int, int) emitted to signal a tab relocation - request giving the id of the old tab widget, the index in the old tab widget - and the new index position - @signal tabCopyRequested(long, int, int) emitted to signal a clone request - giving the id of the source tab widget, the index in the source tab widget - and the new index position + @signal tabRelocateRequested(str, int, int) emitted to signal a tab relocation + request giving the string encoded id of the old tab widget, the index in + the old tab widget and the new index position + @signal tabCopyRequested(str, int, int) emitted to signal a clone request + giving the string encoded id of the source tab widget, the index in the + source tab widget and the new index position @signal tabCopyRequested(int, int) emitted to signal a clone request giving the old and new index position """ tabMoveRequested = pyqtSignal(int, int) - tabRelocateRequested = pyqtSignal(int, int, int) - tabCopyRequested = pyqtSignal(int, int, int) - tabCopyRequested = pyqtSignal(int, int) + tabRelocateRequested = pyqtSignal(str, int, int) + tabCopyRequested = pyqtSignal((str, int, int), (int, int)) def __init__(self, parent=None): """ @@ -85,10 +84,10 @@ index = self.tabAt(event.pos()) mimeData.setText(self.tabText(index)) mimeData.setData("action", "tab-reordering") - mimeData.setData("tabbar-id", QByteArray.number(id(self))) + mimeData.setData("tabbar-id", str(id(self))) mimeData.setData("source-index", QByteArray.number(self.tabAt(self.__dragStartPos))) - mimeData.setData("tabwidget-id", QByteArray.number(id(self.parentWidget()))) + mimeData.setData("tabwidget-id", str(id(self.parentWidget()))) drag.setMimeData(mimeData) if event.modifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier): drag.exec_(Qt.DropActions(Qt.CopyAction)) @@ -119,16 +118,17 @@ @param event reference to the drop event (QDropEvent) """ mimeData = event.mimeData() - oldID = mimeData.data("tabbar-id").toLong()[0] + oldID = int(mimeData.data("tabbar-id")) fromIndex = mimeData.data("source-index").toInt()[0] toIndex = self.tabAt(event.pos()) if oldID != id(self): - parentID = mimeData.data("tabwidget-id").toLong()[0] + parentID = int(mimeData.data("tabwidget-id")) if event.proposedAction() == Qt.MoveAction: - self.tabRelocateRequested.emit(parentID, fromIndex, toIndex) + self.tabRelocateRequested.emit(str(parentID), fromIndex, toIndex) event.acceptProposedAction() elif event.proposedAction() == Qt.CopyAction: - self.tabCopyRequested.emit(parentID, fromIndex, toIndex) + self.tabCopyRequested[str, int, int].emit( + str(parentID), fromIndex, toIndex) event.acceptProposedAction() else: if fromIndex != toIndex: @@ -136,7 +136,7 @@ self.tabMoveRequested.emit(fromIndex, toIndex) event.acceptProposedAction() elif event.proposedAction() == Qt.CopyAction: - self.tabCopyRequested.emit(fromIndex, toIndex) + self.tabCopyRequested[int, int].emit(fromIndex, toIndex) event.acceptProposedAction() super().dropEvent(event) @@ -158,9 +158,9 @@ self.setTabBar(self.__tabBar) self.__tabBar.tabMoveRequested.connect(self.moveTab) - self.__tabBar.tabRelocateRequested.connect(self.relocateTab) - self.__tabBar.tabCopyRequested.connect(self.copyTabOther) - self.__tabBar.tabCopyRequested.connect(self.copyTab) + self.__tabBar.tabRelocateRequested.connect(self.__relocateTab) + self.__tabBar.tabCopyRequested[str, int, int].connect(self.__copyTabOther) + self.__tabBar.tabCopyRequested[int, int].connect(self.__copyTab) self.vm = vm self.editors = [] @@ -316,14 +316,15 @@ else: self.indicator.setColor(QColor("red")) - def addTab(self, editor, title): + def addTab(self, assembly, title): """ Overwritten method to add a new tab. - @param editor the editor object to be added (QScintilla.Editor.Editor) + @param assembly editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) @param title title for the new tab (string) """ - assembly = editor.parent() + editor = assembly.getEditor() super().addTab(assembly, UI.PixmapCache.getIcon("empty.png"), title) if self.closeButton: self.closeButton.setEnabled(True) @@ -339,16 +340,17 @@ if emptyIndex > -1: self.removeTab(emptyIndex) - def insertWidget(self, index, editor, title): + def insertWidget(self, index, assembly, title): """ Overwritten method to insert a new tab. @param index index position for the new tab (integer) - @param editor the editor object to be added (QScintilla.Editor.Editor) + @param assembly editor assembly object to be added + (QScintilla.EditorAssembly.EditorAssembly) @param title title for the new tab (string) @return index of the inserted tab (integer) """ - assembly = editor.parent() + editor = assembly.getEditor() newIndex = super().insertTab(index, assembly, UI.PixmapCache.getIcon("empty.png"), title) @@ -420,26 +422,26 @@ self.setTabsClosable(False) self.navigationButton.setEnabled(False) - def relocateTab(self, sourceId, sourceIndex, targetIndex): + def __relocateTab(self, sourceId, sourceIndex, targetIndex): """ - Public method to relocate an editor from another TabWidget. + Private method to relocate an editor from another TabWidget. - @param sourceId id of the TabWidget to get the editor from (long) + @param sourceId id of the TabWidget to get the editor from (string) @param sourceIndex index of the tab in the old tab widget (integer) @param targetIndex index position to place it to (integer) """ - tw = self.vm.getTabWidgetById(sourceId) + tw = self.vm.getTabWidgetById(int(sourceId)) if tw is not None: # step 1: get data of the tab of the source toolTip = tw.tabToolTip(sourceIndex) text = tw.tabText(sourceIndex) icon = tw.tabIcon(sourceIndex) whatsThis = tw.tabWhatsThis(sourceIndex) - editor = tw.widget(sourceIndex).getEditor() + assembly = tw.widget(sourceIndex) # step 2: relocate the tab - tw.removeWidget(editor) - self.insertWidget(targetIndex, editor, text) + tw.removeWidget(assembly.getEditor()) + self.insertWidget(targetIndex, assembly, text) # step 3: set the tab data again self.setTabIcon(targetIndex, icon) @@ -449,33 +451,33 @@ # step 4: set current widget self.setCurrentIndex(targetIndex) - def copyTabOther(self, sourceId, sourceIndex, targetIndex): + def __copyTabOther(self, sourceId, sourceIndex, targetIndex): """ - Public method to copy an editor from another TabWidget. + Private method to copy an editor from another TabWidget. - @param sourceId id of the TabWidget to get the editor from (long) + @param sourceId id of the TabWidget to get the editor from (string) @param sourceIndex index of the tab in the old tab widget (integer) @param targetIndex index position to place it to (integer) """ - tw = self.vm.getTabWidgetById(sourceId) + tw = self.vm.getTabWidgetById(int(sourceId)) if tw is not None: editor = tw.widget(sourceIndex).getEditor() - newEditor = self.vm.cloneEditor(editor, editor.getFileType(), + newEditor, assembly = self.vm.cloneEditor(editor, editor.getFileType(), editor.getFileName()) - self.vm.insertView(newEditor, self, targetIndex, + self.vm.insertView(assembly, self, targetIndex, editor.getFileName(), editor.getNoName()) - def copyTab(self, sourceIndex, targetIndex): + def __copyTab(self, sourceIndex, targetIndex): """ - Public method to copy an editor. + Private method to copy an editor. @param sourceIndex index of the tab (integer) @param targetIndex index position to place it to (integer) """ editor = self.widget(sourceIndex).getEditor() - newEditor = self.vm.cloneEditor(editor, editor.getFileType(), + newEditor, assembly = self.vm.cloneEditor(editor, editor.getFileType(), editor.getFileName()) - self.vm.insertView(newEditor, self, targetIndex, + self.vm.insertView(assembly, self, targetIndex, editor.getFileName(), editor.getNoName()) def currentWidget(self): @@ -790,16 +792,17 @@ """ Protected method to add a view (i.e. window) - @param win editor window to be added + @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) """ + editor = win.getEditor() if fn is None: if not noName: self.untitledCount += 1 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) self.currentTabWidget.addTab(win, noName) - win.setNoName(noName) + editor.setNoName(noName) else: if self.filenameOnly: txt = os.path.basename(fn) @@ -814,7 +817,7 @@ self.currentTabWidget.setTabToolTip(index, fn) self.currentTabWidget.setCurrentWidget(win) win.show() - win.setFocus() + editor.setFocus() if fn: self.changeCaption.emit(fn) self.editorChanged.emit(fn) @@ -825,18 +828,19 @@ """ Protected method to add a view (i.e. window) - @param win editor window to be added + @param win editor assembly to be inserted @param tabWidget reference to the tab widget to insert the editor into (TabWidget) @param index index position to insert at (integer) @param fn filename of this editor (string) @param noName name to be used for an unnamed editor (string) """ + editor = win.getEditor() if fn is None: if not noName: self.untitledCount += 1 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) tabWidget.insertWidget(index, win, noName) - win.setNoName(noName) + editor.setNoName(noName) else: if self.filenameOnly: txt = os.path.basename(fn) @@ -850,15 +854,15 @@ tabWidget.setTabToolTip(nindex, fn) tabWidget.setCurrentWidget(win) win.show() - win.setFocus() + editor.setFocus() if fn: self.changeCaption.emit(fn) self.editorChanged.emit(fn) else: self.changeCaption.emit("") - self._modificationStatusChanged(win.isModified(), win) - self._checkActions(win) + self._modificationStatusChanged(editor.isModified(), editor) + self._checkActions(editor) def _showView(self, win, fn=None): """
--- a/ViewManager/ViewManager.py Thu Nov 03 17:52:13 2011 +0100 +++ b/ViewManager/ViewManager.py Fri Nov 04 13:26:01 2011 +0100 @@ -302,7 +302,7 @@ """ Protected method to add a view (i.e. window) - @param win editor window to be added + @param win editor assembly to be added @param fn filename of this editor @param noName name to be used for an unnamed editor (string) @exception RuntimeError Not implemented @@ -3242,9 +3242,9 @@ @param caller reference to the editor calling this method @param filetype type of the source file (string) """ - editor = self.cloneEditor(caller, filetype, fn) - - self._addView(editor, fn, caller.getNoName()) + editor, assembly = self.cloneEditor(caller, filetype, fn) + + self._addView(assembly, fn, caller.getNoName()) self._modificationStatusChanged(editor.isModified(), editor) self._checkActions(editor) @@ -3255,7 +3255,8 @@ @param caller reference to the editor calling this method @param filetype type of the source file (string) @param fn filename of this view - @return reference to the new editor object (Editor.Editor) + @return reference to the new editor object (Editor.Editor) and the new + edito assembly object (EditorAssembly.EditorAssembly) """ assembly = EditorAssembly(self.dbs, fn, self, filetype=filetype, editor=caller, tv=e5App().getObject("TaskViewer")) @@ -3266,7 +3267,7 @@ self.editorOpened.emit(fn) self.editorOpenedEd.emit(editor) - return editor + return editor, assembly def addToRecentList(self, fn): """ @@ -3422,7 +3423,7 @@ newWin = True if newWin: - self._addView(editor, fn) + self._addView(assembly, fn) else: self._showView(editor, fn) @@ -3591,7 +3592,7 @@ editor = assembly.getEditor() self.editors.append(editor) self.__connectEditor(editor) - self._addView(editor, None) + self._addView(assembly, None) self.__editorOpened() self._checkActions(editor) self.editorOpened.emit("")