eric6/QScintilla/Shell.py

changeset 8143
2c730d5fd177
parent 8138
169e65a6787c
child 8146
db2d19af4675
diff -r 27f636beebad -r 2c730d5fd177 eric6/QScintilla/Shell.py
--- a/eric6/QScintilla/Shell.py	Mon Mar 01 17:48:43 2021 +0100
+++ b/eric6/QScintilla/Shell.py	Tue Mar 02 17:17:09 2021 +0100
@@ -58,8 +58,8 @@
         
         from UI.SearchWidget import SearchWidget
         self.__searchWidget = SearchWidget(self.__shell, self, horizontal)
-        self.__searchWidget.setSizePolicy(QSizePolicy.Fixed,
-                                          QSizePolicy.Preferred)
+        self.__searchWidget.setSizePolicy(QSizePolicy.Policy.Fixed,
+                                          QSizePolicy.Policy.Preferred)
         self.__searchWidget.hide()
         
         if horizontal:
@@ -374,14 +374,15 @@
         
         self.__queuedText = ''
         self.__blockTextProcessing = False
-        self.queueText.connect(self.__concatenateText, Qt.QueuedConnection)
+        self.queueText.connect(self.__concatenateText,
+                               Qt.ConnectionType.QueuedConnection)
         
         self.__project = project
         if self.__project:
             self.__project.projectOpened.connect(self.__projectOpened)
             self.__project.projectClosed.connect(self.__projectClosed)
         
-        self.grabGesture(Qt.PinchGesture)
+        self.grabGesture(Qt.GestureType.PinchGesture)
     
     def __showStartMenu(self):
         """
@@ -479,7 +480,8 @@
         """
         self.setTabWidth(Preferences.getEditor("TabWidth"))
         if Preferences.getEditor("ShowWhitespace"):
-            self.setWhitespaceVisibility(QsciScintilla.WsVisible)
+            self.setWhitespaceVisibility(
+                QsciScintilla.WhitespaceVisibility.WsVisible)
             try:
                 self.setWhitespaceForegroundColor(
                     Preferences.getEditorColour("WhitespaceForeground"))
@@ -491,12 +493,13 @@
                 # QScintilla before 2.5 doesn't support this
                 pass
         else:
-            self.setWhitespaceVisibility(QsciScintilla.WsInvisible)
+            self.setWhitespaceVisibility(
+                QsciScintilla.WhitespaceVisibility.WsInvisible)
         self.setEolVisibility(Preferences.getEditor("ShowEOL"))
         if Preferences.getEditor("BraceHighlighting"):
-            self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
+            self.setBraceMatching(QsciScintilla.BraceMatch.SloppyBraceMatch)
         else:
-            self.setBraceMatching(QsciScintilla.NoBraceMatch)
+            self.setBraceMatching(QsciScintilla.BraceMatch.NoBraceMatch)
         self.setMatchedBraceForegroundColor(
             Preferences.getEditorColour("MatchingBrace"))
         self.setMatchedBraceBackgroundColor(
@@ -510,7 +513,7 @@
                 Preferences.getEditorColour("SelectionBackground"))
         else:
             self.setSelectionBackgroundColor(
-                QApplication.palette().color(QPalette.Highlight))
+                QApplication.palette().color(QPalette.ColorRole.Highlight))
         if Preferences.getEditor("ColourizeSelText"):
             self.resetSelectionForegroundColor()
         elif Preferences.getEditor("CustomSelectionColours"):
@@ -518,7 +521,8 @@
                 Preferences.getEditorColour("SelectionForeground"))
         else:
             self.setSelectionForegroundColor(
-                QApplication.palette().color(QPalette.HighlightedText))
+                QApplication.palette().color(
+                    QPalette.ColorRole.HighlightedText))
         self.setSelectionToEol(Preferences.getEditor("ExtendSelectionToEol"))
         self.setCaretForegroundColor(
             Preferences.getEditorColour("CaretForeground"))
@@ -526,9 +530,9 @@
         self.caretWidth = Preferences.getEditor("CaretWidth")
         self.setCaretWidth(self.caretWidth)
         if Preferences.getShell("WrapEnabled"):
-            self.setWrapMode(QsciScintilla.WrapWord)
+            self.setWrapMode(QsciScintilla.WrapMode.WrapWord)
         else:
-            self.setWrapMode(QsciScintilla.WrapNone)
+            self.setWrapMode(QsciScintilla.WrapMode.WrapNone)
         self.useMonospaced = Preferences.getShell("UseMonospacedFont")
         self.__setMonospaced(self.useMonospaced)
         
@@ -586,18 +590,21 @@
                 Preferences.getEditorColour("CallTipsHighlight"))
             self.setCallTipsVisible(Preferences.getEditor("CallTipsVisible"))
             calltipsStyle = Preferences.getEditor("CallTipsStyle")
-            if calltipsStyle == QsciScintilla.CallTipsNoContext:
-                self.setCallTipsStyle(QsciScintilla.CallTipsNoContext)
+            if calltipsStyle == QsciScintilla.CallTipsStyle.CallTipsNoContext:
+                self.setCallTipsStyle(
+                    QsciScintilla.CallTipsStyle.CallTipsNoContext)
             elif (
                 calltipsStyle ==
-                    QsciScintilla.CallTipsNoAutoCompletionContext
+                    QsciScintilla.CallTipsStyle.CallTipsNoAutoCompletionContext
             ):
                 self.setCallTipsStyle(
-                    QsciScintilla.CallTipsNoAutoCompletionContext)
+                    QsciScintilla.CallTipsStyle
+                    .CallTipsNoAutoCompletionContext)
             else:
-                self.setCallTipsStyle(QsciScintilla.CallTipsContext)
+                self.setCallTipsStyle(
+                    QsciScintilla.CallTipsStyle.CallTipsContext)
         else:
-            self.setCallTipsStyle(QsciScintilla.CallTipsNone)
+            self.setCallTipsStyle(QsciScintilla.CallTipsStyle.CallTipsNone)
         
     def setDebuggerUI(self, ui):
         """
@@ -786,7 +793,7 @@
         """
         from .ShellHistoryDialog import ShellHistoryDialog
         dlg = ShellHistoryDialog(self.__history, self.vm, self)
-        if dlg.exec() == QDialog.Accepted:
+        if dlg.exec() == QDialog.DialogCode.Accepted:
             self.__historyLists[self.clientType], idx = dlg.getHistory()
             self.__history = self.__historyLists[self.clientType]
             self.__setHistoryIndex(index=idx)
@@ -1232,8 +1239,8 @@
         @param event the mouse press event (QMouseEvent)
         """
         self.setFocus()
-        if event.button() == Qt.MidButton:
-            lines = QApplication.clipboard().text(QClipboard.Selection)
+        if event.button() == Qt.MouseButton.MidButton:
+            lines = QApplication.clipboard().text(QClipboard.Mode.Selection)
             self.paste(lines)
         else:
             super(Shell, self).mousePressEvent(event)
@@ -1244,7 +1251,7 @@
         
         @param evt reference to the wheel event (QWheelEvent)
         """
-        if evt.modifiers() & Qt.ControlModifier:
+        if evt.modifiers() & Qt.KeyboardModifier.ControlModifier:
             delta = evt.angleDelta().y()
             if delta < 0:
                 self.zoomOut()
@@ -1262,7 +1269,7 @@
         @param evt reference to the event (QEvent)
         @return flag indicating, if the event was handled (boolean)
         """
-        if evt.type() == QEvent.Gesture:
+        if evt.type() == QEvent.Type.Gesture:
             self.gestureEvent(evt)
             return True
         
@@ -1274,12 +1281,12 @@
         
         @param evt reference to the gesture event (QGestureEvent
         """
-        pinch = evt.gesture(Qt.PinchGesture)
+        pinch = evt.gesture(Qt.GestureType.PinchGesture)
         if pinch:
-            if pinch.state() == Qt.GestureStarted:
+            if pinch.state() == Qt.GestureState.GestureStarted:
                 zoom = (self.getZoom() + 10) / 10.0
                 pinch.setTotalScaleFactor(zoom)
-            elif pinch.state() == Qt.GestureUpdated:
+            elif pinch.state() == Qt.GestureState.GestureUpdated:
                 zoom = int(pinch.totalScaleFactor() * 10) - 10
                 if zoom <= -9:
                     zoom = -9

eric ide

mercurial