eric6/QScintilla/MiniEditor.py

changeset 8143
2c730d5fd177
parent 7969
62eff8b34a8d
child 8150
fc1ae39af8c9
--- a/eric6/QScintilla/MiniEditor.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/QScintilla/MiniEditor.py	Tue Mar 02 17:17:09 2021 +0100
@@ -294,7 +294,8 @@
             self.__cursorPositionChanged)
         self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin)
         
-        self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu)
+        self.__textEdit.setContextMenuPolicy(
+            Qt.ContextMenuPolicy.CustomContextMenu)
         self.__textEdit.customContextMenuRequested.connect(
             self.__contextMenuRequested)
         
@@ -2853,7 +2854,7 @@
                 Preferences.getEditorColour("FoldMarkersForeground"),
                 Preferences.getEditorColour("FoldMarkersBackground"))
         else:
-            self.__textEdit.setFolding(QsciScintilla.NoFoldStyle)
+            self.__textEdit.setFolding(QsciScintilla.FoldStyle.NoFoldStyle)
     
     def __resizeLinenoMargin(self):
         """
@@ -2893,7 +2894,8 @@
         self.__textEdit.setIndentationGuidesForegroundColor(
             Preferences.getEditorColour("IndentationGuidesForeground"))
         if Preferences.getEditor("ShowWhitespace"):
-            self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsVisible)
+            self.__textEdit.setWhitespaceVisibility(
+                QsciScintilla.WhitespaceVisibility.WsVisible)
             self.__textEdit.setWhitespaceForegroundColor(
                 Preferences.getEditorColour("WhitespaceForeground"))
             self.__textEdit.setWhitespaceBackgroundColor(
@@ -2901,13 +2903,16 @@
             self.__textEdit.setWhitespaceSize(
                 Preferences.getEditor("WhitespaceSize"))
         else:
-            self.__textEdit.setWhitespaceVisibility(QsciScintilla.WsInvisible)
+            self.__textEdit.setWhitespaceVisibility(
+                QsciScintilla.WhitespaceVisibility.WsInvisible)
         self.__textEdit.setEolVisibility(Preferences.getEditor("ShowEOL"))
         self.__textEdit.setAutoIndent(Preferences.getEditor("AutoIndentation"))
         if Preferences.getEditor("BraceHighlighting"):
-            self.__textEdit.setBraceMatching(QsciScintilla.SloppyBraceMatch)
+            self.__textEdit.setBraceMatching(
+                QsciScintilla.BraceMatch.SloppyBraceMatch)
         else:
-            self.__textEdit.setBraceMatching(QsciScintilla.NoBraceMatch)
+            self.__textEdit.setBraceMatching(
+                QsciScintilla.BraceMatch.NoBraceMatch)
         self.__textEdit.setMatchedBraceForegroundColor(
             Preferences.getEditorColour("MatchingBrace"))
         self.__textEdit.setMatchedBraceBackgroundColor(
@@ -2921,7 +2926,7 @@
                 Preferences.getEditorColour("SelectionBackground"))
         else:
             self.__textEdit.setSelectionBackgroundColor(
-                QApplication.palette().color(QPalette.Highlight))
+                QApplication.palette().color(QPalette.ColorRole.Highlight))
         if Preferences.getEditor("ColourizeSelText"):
             self.__textEdit.resetSelectionForegroundColor()
         elif Preferences.getEditor("CustomSelectionColours"):
@@ -2929,7 +2934,8 @@
                 Preferences.getEditorColour("SelectionForeground"))
         else:
             self.__textEdit.setSelectionForegroundColor(
-                QApplication.palette().color(QPalette.HighlightedText))
+                QApplication.palette().color(
+                    QPalette.ColorRole.HighlightedText))
         self.__textEdit.setSelectionToEol(
             Preferences.getEditor("ExtendSelectionToEol"))
         self.__textEdit.setCaretForegroundColor(
@@ -3009,19 +3015,24 @@
         Private slot to print the text.
         """
         from .Printer import Printer
-        printer = Printer(mode=QPrinter.HighResolution)
+        printer = Printer(mode=QPrinter.PrinterMode.HighResolution)
         sb = self.statusBar()
         printDialog = QPrintDialog(printer, self)
         if self.__textEdit.hasSelectedText():
-            printDialog.setOption(QAbstractPrintDialog.PrintSelection, True)
-        if printDialog.exec() == QDialog.Accepted:
+            printDialog.setOption(
+                QAbstractPrintDialog.PrintDialogOption.PrintSelection,
+                True)
+        if printDialog.exec() == QDialog.DialogCode.Accepted:
             sb.showMessage(self.tr('Printing...'))
             QApplication.processEvents()
             if self.__curFile:
                 printer.setDocName(QFileInfo(self.__curFile).fileName())
             else:
                 printer.setDocName(self.tr("Untitled"))
-            if printDialog.printRange() == QAbstractPrintDialog.Selection:
+            if (
+                printDialog.printRange() ==
+                QAbstractPrintDialog.PrintRange.Selection
+            ):
                 # get the selection
                 fromLine, fromIndex, toLine, toIndex = (
                     self.__textEdit.getSelection()
@@ -3048,7 +3059,7 @@
         from PyQt5.QtPrintSupport import QPrintPreviewDialog
         from .Printer import Printer
         
-        printer = Printer(mode=QPrinter.HighResolution)
+        printer = Printer(mode=QPrinter.PrinterMode.HighResolution)
         if self.__curFile:
             printer.setDocName(QFileInfo(self.__curFile).fileName())
         else:
@@ -3741,11 +3752,11 @@
             if option == "EOLMode":
                 value = config["end_of_line"]
                 if value == "lf":
-                    value = QsciScintilla.EolUnix
+                    value = QsciScintilla.EolMode.EolUnix
                 elif value == "crlf":
-                    value = QsciScintilla.EolWindows
+                    value = QsciScintilla.EolMode.EolWindows
                 elif value == "cr":
-                    value = QsciScintilla.EolMac
+                    value = QsciScintilla.EolMode.EolMac
                 else:
                     value = None
             elif option == "DefaultEncoding":
@@ -3850,7 +3861,7 @@
         """
         from QScintilla.ZoomDialog import ZoomDialog
         dlg = ZoomDialog(self.getZoom(), self, None, True)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             value = dlg.getZoomSize()
             self.__zoomTo(value)
         

eric ide

mercurial