eric6/QScintilla/MiniEditor.py

changeset 7267
aedc309827c7
parent 7229
53054eb5b15a
child 7278
1820a0344b62
diff -r d001bc703c29 -r aedc309827c7 eric6/QScintilla/MiniEditor.py
--- a/eric6/QScintilla/MiniEditor.py	Wed Sep 25 18:25:43 2019 +0200
+++ b/eric6/QScintilla/MiniEditor.py	Wed Sep 25 18:37:35 2019 +0200
@@ -11,11 +11,15 @@
 import os
 import re
 
-from PyQt5.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, \
-    pyqtSignal, QSize, QRegExp, Qt, QCoreApplication
+from PyQt5.QtCore import (
+    QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, QRegExp, Qt,
+    QCoreApplication
+)
 from PyQt5.QtGui import QCursor, QKeySequence, QPalette, QFont
-from PyQt5.QtWidgets import QWidget, QWhatsThis, QActionGroup, QDialog, \
-    QInputDialog, QApplication, QMenu, QVBoxLayout, QLabel
+from PyQt5.QtWidgets import (
+    QWidget, QWhatsThis, QActionGroup, QDialog, QInputDialog, QApplication,
+    QMenu, QVBoxLayout, QLabel
+)
 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog, QAbstractPrintDialog
 from PyQt5.Qsci import QsciScintilla
 
@@ -2342,10 +2346,12 @@
         
         modified = False
         
-        if (not self.__getEditorConfig("TabForIndentation")) and \
-                Preferences.getEditor("ConvertTabsOnLoad") and \
-                not (self.lexer_ and
-                     self.lexer_.alwaysKeepTabs()):
+        if (
+            not self.__getEditorConfig("TabForIndentation") and
+            Preferences.getEditor("ConvertTabsOnLoad") and
+            not (self.lexer_ and
+                 self.lexer_.alwaysKeepTabs())
+        ):
             txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth"))
             if txtExpanded != txt:
                 modified = True
@@ -2757,8 +2763,9 @@
                 printer.setDocName(self.tr("Untitled"))
             if printDialog.printRange() == QAbstractPrintDialog.Selection:
                 # get the selection
-                fromLine, fromIndex, toLine, toIndex = \
+                fromLine, fromIndex, toLine, toIndex = (
                     self.__textEdit.getSelection()
+                )
                 if toIndex == 0:
                     toLine -= 1
                 # Qscintilla seems to print one line more than told
@@ -2856,8 +2863,9 @@
         languages = sorted(list(supportedLanguages.keys()))
         for language in languages:
             if language != "Guessed":
-                self.supportedLanguages[language] = \
+                self.supportedLanguages[language] = (
                     supportedLanguages[language][:2]
+                )
                 act = menu.addAction(
                     UI.PixmapCache.getIcon(supportedLanguages[language][2]),
                     self.supportedLanguages[language][0])
@@ -2937,8 +2945,11 @@
         """
         Private method used to reset the language selection.
         """
-        if self.lexer_ is not None and \
-           (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None):
+        if (
+            self.lexer_ is not None and
+            (self.lexer_.lexer() == "container" or
+             self.lexer_.lexer() is None)
+        ):
             self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded)
         
         self.apiLanguage = ""
@@ -2977,8 +2988,10 @@
         
         @return language of the editor (string)
         """
-        if self.apiLanguage == "Guessed" or \
-                self.apiLanguage.startswith("Pygments|"):
+        if (
+            self.apiLanguage == "Guessed" or
+            self.apiLanguage.startswith("Pygments|")
+        ):
             return self.lexer_.name()
         else:
             return self.apiLanguage
@@ -3006,8 +3019,11 @@
             language (string)
         @keyparam pyname name of the pygments lexer to use (string)
         """
-        if self.lexer_ is not None and \
-           (self.lexer_.lexer() == "container" or self.lexer_.lexer() is None):
+        if (
+            self.lexer_ is not None and
+            (self.lexer_.lexer() == "container" or
+             self.lexer_.lexer() is None)
+        ):
             self.__textEdit.SCN_STYLENEEDED.disconnect(self.__styleNeeded)
         
         filename = os.path.basename(filename)
@@ -3063,9 +3079,11 @@
         
         if self.filetype == "":
             line0 = self.__textEdit.text(0)
-            if line0.startswith("#!") and \
-               ("python2" in line0 or
-                    ("python" in line0 and "python3" not in line0)):
+            if (
+                line0.startswith("#!") and
+                ("python2" in line0 or
+                 ("python" in line0 and "python3" not in line0))
+            ):
                 return True
             
             if self.__curFile is not None:

eric ide

mercurial