eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 7258
aff39db4dacc
parent 7229
53054eb5b15a
child 7286
7eb04391adf7
child 7360
9190402e4505
diff -r c4d0cac9b5c9 -r aff39db4dacc eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py
--- a/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sat Sep 21 22:03:03 2019 +0200
+++ b/eric6/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Mon Sep 23 19:10:42 2019 +0200
@@ -10,11 +10,15 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSlot, QPoint, QFileInfo, pyqtSignal, QEvent, \
-    QByteArray, QMimeData, Qt, QSize
+from PyQt5.QtCore import (
+    pyqtSlot, QPoint, QFileInfo, pyqtSignal, QEvent, QByteArray, QMimeData,
+    Qt, QSize
+)
 from PyQt5.QtGui import QColor, QDrag, QPixmap
-from PyQt5.QtWidgets import QWidget, QHBoxLayout, QSplitter, QTabBar, \
-    QApplication, QToolButton, QMenu, QLabel
+from PyQt5.QtWidgets import (
+    QWidget, QHBoxLayout, QSplitter, QTabBar, QApplication, QToolButton,
+    QMenu, QLabel
+)
 
 from E5Gui.E5Application import e5App
 
@@ -84,9 +88,11 @@
         @param event reference to the mouse move event
         @type QMouseEvent
         """
-        if event.buttons() == Qt.MouseButtons(Qt.LeftButton) and \
-           (event.pos() - self.__dragStartPos).manhattanLength() > \
-                QApplication.startDragDistance():
+        if (
+            event.buttons() == Qt.MouseButtons(Qt.LeftButton) and
+            (event.pos() - self.__dragStartPos).manhattanLength() >
+                QApplication.startDragDistance()
+        ):
             drag = QDrag(self)
             mimeData = QMimeData()
             index = self.tabAt(event.pos())
@@ -115,11 +121,13 @@
         """
         mimeData = event.mimeData()
         formats = mimeData.formats()
-        if "action" in formats and \
-           mimeData.data("action") == b"tab-reordering" and \
-           "tabbar-id" in formats and \
-           "source-index" in formats and \
-           "tabwidget-id" in formats:
+        if (
+            "action" in formats and
+            mimeData.data("action") == b"tab-reordering" and
+            "tabbar-id" in formats and
+            "source-index" in formats and
+            "tabwidget-id" in formats
+        ):
             event.acceptProposedAction()
         super(TabBar, self).dragEnterEvent(event)
     
@@ -606,8 +614,10 @@
         Private method to close the other tabs.
         """
         index = self.contextMenuIndex
-        for i in list(range(self.count() - 1, index, -1)) + \
-                list(range(index - 1, -1, -1)):
+        for i in (
+            list(range(self.count() - 1, index, -1)) +
+            list(range(index - 1, -1, -1))
+        ):
             editor = self.widget(i).getEditor()
             self.vm.closeEditorWindow(editor)
         
@@ -878,9 +888,11 @@
         
         # if this was the last editor in this view, switch to the next, that
         # still has open editors
-        for i in list(range(self.tabWidgets.index(tw), -1, -1)) + \
+        for i in (
+            list(range(self.tabWidgets.index(tw), -1, -1)) +
             list(range(self.tabWidgets.index(tw) + 1,
-                 len(self.tabWidgets))):
+                 len(self.tabWidgets)))
+        ):
             if self.tabWidgets[i].hasEditors():
                 self.currentTabWidget.showIndicator(False)
                 self.currentTabWidget = self.tabWidgets[i]
@@ -1321,8 +1333,10 @@
         @return always False
         @rtype bool
         """
-        if event.type() == QEvent.MouseButtonPress and \
-           not event.button() == Qt.RightButton:
+        if (
+            event.type() == QEvent.MouseButtonPress and
+            not event.button() == Qt.RightButton
+        ):
             switched = True
             self.currentTabWidget.showIndicator(False)
             if isinstance(watched, E5TabWidget):
@@ -1333,8 +1347,10 @@
                 self.currentTabWidget = watched.parent()
                 if switched:
                     index = self.currentTabWidget.selectTab(event.pos())
-                    switched = self.currentTabWidget.widget(index) is \
+                    switched = (
+                        self.currentTabWidget.widget(index) is
                         self.activeWindow()
+                    )
             elif isinstance(watched, QScintilla.Editor.Editor):
                 for tw in self.tabWidgets:
                     if tw.hasEditor(watched):
@@ -1379,8 +1395,8 @@
                         if self.filenameOnly:
                             txt = os.path.basename(fn)
                         else:
-                            txt = e5App().getObject("Project")\
-                                .getRelativePath(fn)
+                            txt = e5App().getObject(
+                                "Project").getRelativePath(fn)
                         if len(txt) > self.maxFileNameChars:
                             txt = "...{0}".format(txt[-self.maxFileNameChars:])
                         if not QFileInfo(fn).isWritable():

eric ide

mercurial