diff -r fb0ef164f536 -r 698ae46f40a4 eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py --- a/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py Fri Apr 02 11:59:41 2021 +0200 +++ b/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py Sat May 01 14:27:20 2021 +0200 @@ -13,7 +13,7 @@ pyqtSlot, QPoint, QFileInfo, pyqtSignal, QEvent, QByteArray, QMimeData, Qt, QSize ) -from PyQt5.QtGui import QColor, QDrag, QPixmap +from PyQt5.QtGui import QColor, QDrag, QPixmap, QMouseEvent from PyQt5.QtWidgets import ( QWidget, QHBoxLayout, QSplitter, QTabBar, QApplication, QToolButton, QMenu, QLabel @@ -64,7 +64,7 @@ @param parent reference to the parent widget @type QWidget """ - super(TabBar, self).__init__(parent) + super().__init__(parent) self.setAcceptDrops(True) self.__dragStartPos = QPoint() @@ -78,7 +78,7 @@ """ if event.button() == Qt.MouseButton.LeftButton: self.__dragStartPos = QPoint(event.pos()) - super(TabBar, self).mousePressEvent(event) + super().mousePressEvent(event) def mouseMoveEvent(self, event): """ @@ -113,7 +113,7 @@ Qt.KeyboardModifier.NoModifier ): drag.exec(Qt.DropActions(Qt.DropAction.MoveAction)) - super(TabBar, self).mouseMoveEvent(event) + super().mouseMoveEvent(event) def dragEnterEvent(self, event): """ @@ -132,7 +132,7 @@ "tabwidget-id" in formats ): event.acceptProposedAction() - super(TabBar, self).dragEnterEvent(event) + super().dragEnterEvent(event) def dropEvent(self, event): """ @@ -163,7 +163,7 @@ elif event.proposedAction() == Qt.DropAction.CopyAction: self.tabCopyRequested[int, int].emit(fromIndex, toIndex) event.acceptProposedAction() - super(TabBar, self).dropEvent(event) + super().dropEvent(event) class TabWidget(E5TabWidget): @@ -177,7 +177,7 @@ @param vm view manager widget @type Tabview """ - super(TabWidget, self).__init__() + super().__init__() self.__tabBar = TabBar(self) self.setTabBar(self.__tabBar) @@ -237,7 +237,7 @@ self.emptyLabel.setPixmap(ericPic) self.emptyLabel.setAlignment( Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignHCenter) - super(TabWidget, self).addTab( + super().addTab( self.emptyLabel, UI.PixmapCache.getIcon("empty"), "") @@ -369,7 +369,7 @@ @type str """ editor = assembly.getEditor() - super(TabWidget, self).addTab( + super().addTab( assembly, UI.PixmapCache.getIcon("empty"), title) self.setTabsClosable(True) self.navigationButton.setEnabled(True) @@ -398,7 +398,7 @@ @rtype int """ editor = assembly.getEditor() - newIndex = super(TabWidget, self).insertTab( + newIndex = super().insertTab( index, assembly, UI.PixmapCache.getIcon("empty"), title) @@ -481,7 +481,7 @@ self.removeTab(index) if not self.editors: - super(TabWidget, self).addTab( + super().addTab( self.emptyLabel, UI.PixmapCache.getIcon("empty"), "") self.emptyLabel.show() self.setTabsClosable(False) @@ -563,7 +563,7 @@ if not self.editors: return None else: - return super(TabWidget, self).currentWidget() + return super().currentWidget() def setCurrentWidget(self, assembly): """ @@ -572,7 +572,7 @@ @param assembly editor assembly to determine current tab from @type EditorAssembly.EditorAssembly """ - super(TabWidget, self).setCurrentWidget(assembly) + super().setCurrentWidget(assembly) def indexOf(self, widget): """ @@ -585,7 +585,7 @@ """ if isinstance(widget, QScintilla.Editor.Editor): widget = widget.parent() - return super(TabWidget, self).indexOf(widget) + return super().indexOf(widget) def hasEditor(self, editor): """ @@ -1166,10 +1166,11 @@ tw.currentChanged.connect(self.__currentChanged) tw.installEventFilter(self) tw.tabBar().installEventFilter(self) - if self.__splitter.orientation() == Qt.Orientation.Horizontal: - size = self.width() - else: - size = self.height() + size = ( + self.width() + if self.__splitter.orientation() == Qt.Orientation.Horizontal else + self.height() + ) self.__splitter.setSizes( [int(size / len(self.tabWidgets))] * len(self.tabWidgets)) self.splitRemoveAct.setEnabled(True) @@ -1344,7 +1345,8 @@ """ if ( event.type() == QEvent.Type.MouseButtonPress and - not event.button() == Qt.MouseButton.RightButton + isinstance(event, QMouseEvent) and + event.button() != Qt.MouseButton.RightButton ): switched = True self.currentTabWidget.showIndicator(False)