eric6/QScintilla/QsciScintillaCompat.py

changeset 8143
2c730d5fd177
parent 7998
cd41c844862f
child 8218
7c09585bd960
--- a/eric6/QScintilla/QsciScintillaCompat.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/QScintilla/QsciScintillaCompat.py	Tue Mar 02 17:17:09 2021 +0100
@@ -41,7 +41,7 @@
     """
     zoomValueChanged = pyqtSignal(int)
     
-    ArrowFoldStyle = QsciScintilla.BoxedTreeFoldStyle + 1
+    ArrowFoldStyle = QsciScintilla.FoldStyle.BoxedTreeFoldStyle + 1
     ArrowTreeFoldStyle = ArrowFoldStyle + 1
     
     UserSeparator = '\x04'
@@ -118,10 +118,10 @@
         palette = QApplication.palette()
         self.SendScintilla(QsciScintilla.SCI_STYLESETFORE,
                            QsciScintilla.STYLE_DEFAULT,
-                           palette.color(QPalette.Text))
+                           palette.color(QPalette.ColorRole.Text))
         self.SendScintilla(QsciScintilla.SCI_STYLESETBACK,
                            QsciScintilla.STYLE_DEFAULT,
-                           palette.color(QPalette.Base))
+                           palette.color(QPalette.ColorRole.Base))
         self.SendScintilla(QsciScintilla.SCI_STYLECLEARALL)
         self.SendScintilla(QsciScintilla.SCI_CLEARDOCUMENTSTYLE)
     
@@ -653,11 +653,11 @@
         @return eol string (string)
         """
         m = self.eolMode()
-        if m == QsciScintilla.EolWindows:
+        if m == QsciScintilla.EolMode.EolWindows:
             eol = '\r\n'
-        elif m == QsciScintilla.EolUnix:
+        elif m == QsciScintilla.EolMode.EolUnix:
             eol = '\n'
-        elif m == QsciScintilla.EolMac:
+        elif m == QsciScintilla.EolMode.EolMac:
             eol = '\r'
         else:
             eol = ''
@@ -670,11 +670,11 @@
         @return eol indicator (string)
         """
         m = self.eolMode()
-        if m == QsciScintilla.EolWindows:
+        if m == QsciScintilla.EolMode.EolWindows:
             eol = 'CRLF'
-        elif m == QsciScintilla.EolUnix:
+        elif m == QsciScintilla.EolMode.EolUnix:
             eol = 'LF'
-        elif m == QsciScintilla.EolMac:
+        elif m == QsciScintilla.EolMode.EolMac:
             eol = 'CR'
         else:
             eol = ''
@@ -687,11 +687,14 @@
         @param eolStr eol string (string)
         """
         if eolStr == '\r\n':
-            self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolWindows))
+            self.setEolMode(
+                QsciScintilla.EolMode(QsciScintilla.EolMode.EolWindows))
         elif eolStr == '\n':
-            self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolUnix))
+            self.setEolMode(
+                QsciScintilla.EolMode(QsciScintilla.EolMode.EolUnix))
         elif eolStr == '\r':
-            self.setEolMode(QsciScintilla.EolMode(QsciScintilla.EolMac))
+            self.setEolMode(
+                QsciScintilla.EolMode(QsciScintilla.EolMode.EolMac))
     
     def detectEolString(self, txt):
         """
@@ -1294,9 +1297,9 @@
         
         if mark != QsciScintilla.SC_MARK_EMPTY:
             self.SendScintilla(QsciScintilla.SCI_MARKERSETFORE,
-                               marknr, QColor(Qt.white))
+                               marknr, QColor(Qt.GlobalColor.white))
             self.SendScintilla(QsciScintilla.SCI_MARKERSETBACK,
-                               marknr, QColor(Qt.black))
+                               marknr, QColor(Qt.GlobalColor.black))
     
     def setFolding(self, style, margin=2):
         """
@@ -1309,7 +1312,7 @@
             super(QsciScintillaCompat, self).setFolding(style, margin)
         else:
             super(QsciScintillaCompat, self).setFolding(
-                QsciScintilla.PlainFoldStyle, margin)
+                QsciScintilla.FoldStyle.PlainFoldStyle, margin)
             
             if style == self.ArrowFoldStyle:
                 self.__setFoldMarker(QsciScintilla.SC_MARKNUM_FOLDER,
@@ -1436,8 +1439,8 @@
         """
         if self.isListActive():
             if event.reason() in [
-                Qt.ActiveWindowFocusReason,
-                Qt.OtherFocusReason
+                Qt.FocusReason.ActiveWindowFocusReason,
+                Qt.FocusReason.OtherFocusReason
             ]:
                 aw = QApplication.activeWindow()
                 if aw is None or aw.parent() is not self:
@@ -1447,8 +1450,8 @@
         
         if self.isCallTipActive():
             if event.reason() in [
-                Qt.ActiveWindowFocusReason,
-                Qt.OtherFocusReason
+                Qt.FocusReason.ActiveWindowFocusReason,
+                Qt.FocusReason.OtherFocusReason
             ]:
                 aw = QApplication.activeWindow()
                 if aw is None or aw.parent() is not self:
@@ -1550,7 +1553,8 @@
             
             # Workaround for getting all items instead of
             # userListWidget.items() call with unknown mime types.
-            all_items = userListWidget.findItems('', Qt.MatchStartsWith)
+            all_items = userListWidget.findItems(
+                '', Qt.MatchFlag.MatchStartsWith)
             if not all_items:
                 return
             
@@ -1587,7 +1591,7 @@
                 # List box doesn't honor limited size to show scroll bars.
                 # So just force it.
                 userListWidget.setHorizontalScrollBarPolicy(
-                    Qt.ScrollBarAlwaysOn)
+                    Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
             
             if len(all_items) > self.maxLines:
                 width += userListWidget.verticalScrollBar().sizeHint().width()

eric ide

mercurial