Continued porting eric to PyQt6. eric7

Mon, 17 May 2021 19:58:15 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 17 May 2021 19:58:15 +0200
branch
eric7
changeset 8319
ea11a3948f40
parent 8318
962bce857696
child 8322
b422b4e77d19

Continued porting eric to PyQt6.

eric7/E5Gui/E5ClickableLabel.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5ErrorMessage.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5FileDialog.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5Led.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5LineEdit.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5LineEditButton.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5MapWidget.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5ModelMenu.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5ModelToolBar.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5PathPicker.py file | annotate | diff | comparison | revisions
eric7/E5Gui/E5SideBar.py file | annotate | diff | comparison | revisions
eric7/E5XML/XMLStreamReaderBase.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsMercurial/HgClient.py file | annotate | diff | comparison | revisions
eric7/Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/EditorStylesPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/HexEditorPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/ShellPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/TemplatesPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/WebBrowserAppearancePage.py file | annotate | diff | comparison | revisions
eric7/Preferences/__init__.py file | annotate | diff | comparison | revisions
eric7/QScintilla/Editor.py file | annotate | diff | comparison | revisions
eric7/Sessions/SessionFile.py file | annotate | diff | comparison | revisions
eric7/UI/NotificationWidget.py file | annotate | diff | comparison | revisions
eric7/UI/UserInterface.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/AutoScroll/AutoScroller.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/UrlBar/FavIconLabel.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/UrlBar/UrlBar.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
--- a/eric7/E5Gui/E5ClickableLabel.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5ClickableLabel.py	Mon May 17 19:58:15 2021 +0200
@@ -44,13 +44,13 @@
             self.rect().contains(evt.position().toPoint())
         ):
             if evt.modifiers() == Qt.KeyboardModifier.ControlModifier:
-                self.middleClicked.emit(evt.globalPos())
+                self.middleClicked.emit(evt.globalPosition().toPoint())
             else:
-                self.clicked.emit(evt.globalPos())
+                self.clicked.emit(evt.globalPosition().toPoint())
         elif (
             evt.button() == Qt.MouseButton.MiddleButton and
             self.rect().contains(evt.position().toPoint())
         ):
-            self.middleClicked.emit(evt.globalPos())
+            self.middleClicked.emit(evt.globalPosition().toPoint())
         else:
             super().mouseReleaseEvent(evt)
--- a/eric7/E5Gui/E5ErrorMessage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5ErrorMessage.py	Mon May 17 19:58:15 2021 +0200
@@ -114,7 +114,7 @@
     @type bytes
     """
     if _msgHandlerDialog:
-        if msgType < Preferences.getUI("MinimumMessageTypeSeverity"):
+        if msgType.value < Preferences.getUI("MinimumMessageTypeSeverity"):
             # severity is lower than configured
             # just ignore the message
             return
--- a/eric7/E5Gui/E5FileDialog.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5FileDialog.py	Mon May 17 19:58:15 2021 +0200
@@ -56,13 +56,10 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return name of file to be opened (string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     return QFileDialog.getOpenFileName(
         parent, caption, directory, filterStr, "", options)[0]
 
@@ -82,13 +79,10 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return name of file to be opened and selected filter (string, string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     newfilter = __reorderFilter(filterStr, initialFilter)
     return QFileDialog.getOpenFileName(
         parent, caption, directory, newfilter, initialFilter, options)
@@ -106,13 +100,10 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return list of file names to be opened (list of string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     return QFileDialog.getOpenFileNames(
         parent, caption, directory, filterStr, "", options)[0]
 
@@ -133,13 +124,10 @@
     @return list of file names to be opened and selected filter
         (list of string, string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     newfilter = __reorderFilter(filterStr, initialFilter)
     return QFileDialog.getOpenFileNames(
         parent, caption, directory, newfilter, initialFilter, options)
@@ -157,13 +145,10 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return name of file to be saved (string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     return QFileDialog.getSaveFileName(
         parent, caption, directory, filterStr, "", options)[0]
 
@@ -183,13 +168,10 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return name of file to be saved and selected filter (string, string)
     """
-##    if options is None:
-##        options = QFileDialog.Options()
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
-        if options is None:
-            options = QFileDialog.Option.DontUseNativeDialog
-        else:
-            options |= QFileDialog.Option.DontUseNativeDialog
+        options |= QFileDialog.Option.DontUseNativeDialog
     newfilter = __reorderFilter(filterStr, initialFilter)
     return QFileDialog.getSaveFileName(
         parent, caption, directory, newfilter, initialFilter, options)
@@ -207,6 +189,8 @@
     @param options various options for the dialog (QFileDialog.Options)
     @return name of selected directory (string)
     """
+    if options is None:
+        options = QFileDialog.Option(0)
     if Globals.isLinuxPlatform():
         options |= QFileDialog.Option.DontUseNativeDialog
     return QFileDialog.getExistingDirectory(parent, caption, directory,
--- a/eric7/E5Gui/E5Led.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5Led.py	Mon May 17 19:58:15 2021 +0200
@@ -324,13 +324,13 @@
             self.rect().contains(evt.position().toPoint())
         ):
             if evt.modifiers() == Qt.KeyboardModifier.ControlModifier:
-                self.middleClicked.emit(evt.globalPos())
+                self.middleClicked.emit(evt.globalPosition().toPoint())
             else:
-                self.clicked.emit(evt.globalPos())
+                self.clicked.emit(evt.globalPosition().toPoint())
         elif (
             evt.button() == Qt.MouseButton.MiddleButton and
             self.rect().contains(evt.position().toPoint())
         ):
-            self.middleClicked.emit(evt.globalPos())
+            self.middleClicked.emit(evt.globalPosition().toPoint())
         else:
             super().mouseReleaseEvent(evt)
--- a/eric7/E5Gui/E5LineEdit.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5LineEdit.py	Mon May 17 19:58:15 2021 +0200
@@ -15,8 +15,6 @@
     QSpacerItem, QSizePolicy
 )
 
-import UI.PixmapCache
-
 
 class E5LineEditSideWidget(QWidget):
     """
@@ -278,19 +276,4 @@
         """
         super().__init__(parent, inactiveText)
         
-        from E5Gui.E5LineEditButton import E5LineEditButton
-        self.__clearButton = E5LineEditButton(self)
-        self.__clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft"))
-        self.addWidget(self.__clearButton, side)
-        self.__clearButton.setVisible(False)
-        
-        self.__clearButton.clicked.connect(self.clear)
-        self.textChanged.connect(self.__textChanged)
-    
-    def __textChanged(self, txt):
-        """
-        Private slot to handle changes of the text.
-        
-        @param txt text (string)
-        """
-        self.__clearButton.setVisible(txt != "")
+        self.setClearButtonEnabled(True)
--- a/eric7/E5Gui/E5LineEditButton.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5LineEditButton.py	Mon May 17 19:58:15 2021 +0200
@@ -12,6 +12,7 @@
 from PyQt6.QtWidgets import QAbstractButton
 
 
+# TODO: Get rid of this
 class E5LineEditButton(QAbstractButton):
     """
     Class implementing a button to be used with E5LineEdit.
--- a/eric7/E5Gui/E5MapWidget.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5MapWidget.py	Mon May 17 19:58:15 2021 +0200
@@ -267,8 +267,8 @@
                 vsbw = vsb.contentsRect().width()
             else:
                 vsbw = 0
-            left, top, right, bottom = self._master.getContentsMargins()
-            if right > vsbw:
+            margins = self._master.contentsMargins()
+            if margins.right() > vsbw:
                 vsbw = 0
             if self.__rightSide:
                 self.setGeometry(
--- a/eric7/E5Gui/E5ModelMenu.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5ModelMenu.py	Mon May 17 19:58:15 2021 +0200
@@ -42,8 +42,7 @@
         self.setAcceptDrops(True)
         
         self._mouseButton = Qt.MouseButton.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(
-            Qt.KeyboardModifier.NoModifier)
+        self._keyboardModifiers = Qt.KeyboardModifier.NoModifier
         self.__dropRow = -1
         self.__dropIndex = None
         
@@ -429,8 +428,7 @@
         Public method to reset the saved internal state.
         """
         self._mouseButton = Qt.MouseButton.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(
-            Qt.KeyboardModifier.NoModifier)
+        self._keyboardModifiers = Qt.KeyboardModifier.NoModifier
     
     def removeEntry(self, idx):
         """
--- a/eric7/E5Gui/E5ModelToolBar.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5ModelToolBar.py	Mon May 17 19:58:15 2021 +0200
@@ -43,8 +43,7 @@
         self.setAcceptDrops(True)
         
         self._mouseButton = Qt.MouseButton.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(
-            Qt.KeyboardModifier.NoModifier)
+        self._keyboardModifiers = Qt.KeyboardModifier.NoModifier
         self.__dropRow = -1
         self.__dropIndex = None
     
@@ -179,7 +178,7 @@
             evt.type() == QEvent.Type.MouseButtonPress and
             evt.buttons() & Qt.MouseButton.LeftButton
         ):
-            self.__dragStartPosition = self.mapFromGlobal(evt.globalPos())
+            self.__dragStartPosition = self.mapFromGlobal(evt.globalPosition().toPoint())
         
         return False
     
@@ -291,5 +290,4 @@
         Public method to reset the saved internal state.
         """
         self._mouseButton = Qt.MouseButton.NoButton
-        self._keyboardModifiers = Qt.KeyboardModifiers(
-            Qt.KeyboardModifier.NoModifier)
+        self._keyboardModifiers = Qt.KeyboardModifier.NoModifier
--- a/eric7/E5Gui/E5PathPicker.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5PathPicker.py	Mon May 17 19:58:15 2021 +0200
@@ -82,7 +82,7 @@
         self.__defaultDirectory = ""
         self.__windowTitle = ""
         
-        self.__layout = QHBoxLayout()
+        self.__layout = QHBoxLayout(self)
         self.__layout.setSpacing(0)
         self.__layout.setContentsMargins(0, 0, 0, 0)
         self.setLayout(self.__layout)
--- a/eric7/E5Gui/E5SideBar.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5Gui/E5SideBar.py	Mon May 17 19:58:15 2021 +0200
@@ -582,7 +582,7 @@
         
         data = QByteArray()
         stream = QDataStream(data, QIODevice.OpenModeFlag.WriteOnly)
-        stream.setVersion(QDataStream.Version.Qt_4_6)
+        stream.setVersion(QDataStream.Version.Qt_6_1)
         
         stream.writeUInt16(self.Version)
         stream.writeBool(self.__minimized)
@@ -615,7 +615,7 @@
         
         data = QByteArray(state)
         stream = QDataStream(data, QIODevice.OpenModeFlag.ReadOnly)
-        stream.setVersion(QDataStream.Version.Qt_4_6)
+        stream.setVersion(QDataStream.Version.Qt_6_1)
         version = stream.readUInt16()  # version
         minimized = stream.readBool()
         
@@ -637,6 +637,12 @@
             self.splitterSizes = []
             for _ in range(count):
                 self.splitterSizes.append(stream.readUInt32())
+        else:
+            # TODO: determine why version is always 0
+            # set some defaults for unknown versions
+            self.__minSize = minSize
+            self.__maxSize = maxSize
+            self.splitterSizes = []
         
         self.__autoHide = stream.readBool()
         self.__autoHideButton.setChecked(not self.__autoHide)
--- a/eric7/E5XML/XMLStreamReaderBase.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/E5XML/XMLStreamReaderBase.py	Mon May 17 19:58:15 2021 +0200
@@ -111,10 +111,21 @@
         @param default default value (string)
         @return value of the requested tag attribute (string)
         """
-        att = self.attributes().value(name)
-        if att == "":
-            att = default
-        return att
+        attributes = self.attributes()
+        for attribute in attributes:
+            if attribute.name() == name:
+                value = attribute.value()
+                if not value:
+                    value = default
+                break
+        else:
+            value = default
+        return value
+        # TODO: re-enable this code once PyQt6 is fixed and released
+##        att = self.attributes().value(name)
+##        if att == "":
+##            att = default
+##        return att
     
     def _skipUnknownElement(self):
         """
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/HgClient.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/HgClient.py	Mon May 17 19:58:15 2021 +0200
@@ -264,7 +264,7 @@
             if self.__server is None:
                 return -1
             
-            if self.__server is None or self.__server.bytesAvailable() == 0:
+            if self.__server.bytesAvailable() == 0:
                 QThread.msleep(50)
                 continue
             channel, data = self.__readChannel()
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Mon May 17 19:58:15 2021 +0200
@@ -2839,6 +2839,7 @@
         args = self.initCommand("showconfig")
         args.append('extensions')
         
+        return
         output, error = self.__client.runcommand(args)
         
         if output:
--- a/eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Plugins/ViewManagerPlugins/Tabview/Tabview.py	Mon May 17 19:58:15 2021 +0200
@@ -105,14 +105,10 @@
                 "tabwidget-id",
                 str(id(self.parentWidget())).encode("utf-8"))
             drag.setMimeData(mimeData)
-            if event.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.ShiftModifier
-            ):
-                drag.exec(Qt.DropActions(Qt.DropAction.CopyAction))
-            elif event.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.NoModifier
-            ):
-                drag.exec(Qt.DropActions(Qt.DropAction.MoveAction))
+            if event.modifiers() == Qt.KeyboardModifier.ShiftModifier:
+                drag.exec(Qt.DropAction.CopyAction)
+            elif event.modifiers() == Qt.KeyboardModifier.NoModifier:
+                drag.exec(Qt.DropAction.MoveAction)
         super().mouseMoveEvent(event)
     
     def dragEnterEvent(self, event):
--- a/eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py	Mon May 17 19:58:15 2021 +0200
@@ -9,7 +9,7 @@
 
 from PyQt6.QtCore import pyqtSlot, pyqtSignal
 from PyQt6.QtGui import QIcon, QPixmap, QColor
-from PyQt6.QtWidgets import QWidget, QColorDialog, QFontDialog
+from PyQt6.QtWidgets import QWidget, QColorDialog, QFontDialog, QDialog
 
 
 class ConfigurationPageBase(QWidget):
@@ -92,7 +92,7 @@
             lambda col: self.colourChanged.emit(colorKey, col))
         colDlg.exec()
         
-        if colDlg.result() == colDlg.Accepted:
+        if colDlg.result() == QDialog.DialogCode.Accepted:
             colour = colDlg.selectedColor()
             size = button.iconSize()
             pm = QPixmap(size.width(), size.height())
@@ -125,11 +125,11 @@
         @param showFontInfo flag indicating to show some font info
             as the sample (boolean)
         @param options options for the font dialog
-            (QFontDialog.FontDialogOptions)
+            (QFontDialog.FontDialogOption)
         @return selected font (QFont)
         """
         if options is None:
-            options = QFontDialog.FontDialogOptions(0)
+            options = QFontDialog.FontDialogOption(0)
         font, ok = QFontDialog.getFont(fontVar, self, "", options)
         if ok:
             fontSample.setFont(font)
--- a/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py	Mon May 17 19:58:15 2021 +0200
@@ -23,12 +23,6 @@
 
 import UI.PixmapCache
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-NoFontsOption = QFontDialog.FontDialogOptions(0)
-
 
 class EditorHighlightingStylesPage(ConfigurationPageBase,
                                    Ui_EditorHighlightingStylesPage):
@@ -355,9 +349,9 @@
         
         style, substyle = self.__currentStyles()
         options = (
-            MonospacedFontsOption
+            QFontDialog.FontDialogOption.MonospacedFonts
             if self.monospacedButton.isChecked() else
-            NoFontsOption
+            QFontDialog.FontDialogOption(0)
         )
         font, ok = QFontDialog.getFont(self.lexer.font(style, substyle), self,
                                        "", options)
--- a/eric7/Preferences/ConfigurationPages/EditorStylesPage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/EditorStylesPage.py	Mon May 17 19:58:15 2021 +0200
@@ -17,11 +17,6 @@
 
 import Preferences
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-
 
 class EditorStylesPage(ConfigurationPageBase, Ui_EditorStylesPage):
     """
@@ -412,7 +407,7 @@
         """
         self.marginsFont = self.selectFont(
             self.marginsFontSample, self.marginsFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
         
     @pyqtSlot()
     def on_defaultFontButton_clicked(self):
@@ -430,7 +425,7 @@
         """
         self.monospacedFont = self.selectFont(
             self.monospacedFontSample, self.monospacedFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
         
     def polishPage(self):
         """
--- a/eric7/Preferences/ConfigurationPages/HexEditorPage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/HexEditorPage.py	Mon May 17 19:58:15 2021 +0200
@@ -16,11 +16,6 @@
 
 import Preferences
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-
 
 class HexEditorPage(ConfigurationPageBase, Ui_HexEditorPage):
     """
@@ -105,7 +100,7 @@
         """
         self.monospacedFont = self.selectFont(
             self.monospacedFontSample, self.monospacedFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
     
     def polishPage(self):
         """
--- a/eric7/Preferences/ConfigurationPages/ShellPage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/ShellPage.py	Mon May 17 19:58:15 2021 +0200
@@ -15,11 +15,6 @@
 
 import Preferences
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-
 from QScintilla.Shell import ShellHistoryStyle
 
 
@@ -126,7 +121,7 @@
         """
         self.monospacedFont = self.selectFont(
             self.monospacedFontSample, self.monospacedFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
         
     @pyqtSlot()
     def on_linenumbersFontButton_clicked(self):
@@ -135,7 +130,7 @@
         """
         self.marginsFont = self.selectFont(
             self.marginsFontSample, self.marginsFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
         
     def polishPage(self):
         """
--- a/eric7/Preferences/ConfigurationPages/TemplatesPage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/TemplatesPage.py	Mon May 17 19:58:15 2021 +0200
@@ -15,11 +15,6 @@
 
 import Preferences
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-
 
 class TemplatesPage(ConfigurationPageBase, Ui_TemplatesPage):
     """
@@ -72,7 +67,7 @@
         """
         self.editorFont = self.selectFont(
             self.editorFontSample, self.editorFont,
-            options=MonospacedFontsOption)
+            options=QFontDialog.FontDialogOption.MonospacedFonts)
     
 
 def create(dlg):
--- a/eric7/Preferences/ConfigurationPages/WebBrowserAppearancePage.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/ConfigurationPages/WebBrowserAppearancePage.py	Mon May 17 19:58:15 2021 +0200
@@ -8,7 +8,6 @@
 """
 
 from PyQt6.QtGui import QFont
-from PyQt6.QtWidgets import QFontDialog
 
 from E5Gui.E5PathPicker import E5PathPickerModes
 
@@ -17,11 +16,6 @@
 
 import Preferences
 
-try:
-    MonospacedFontsOption = QFontDialog.FontDialogOption.MonospacedFonts
-except AttributeError:
-    MonospacedFontsOption = QFontDialog.FontDialogOptions(0x10)
-
 
 class WebBrowserAppearancePage(ConfigurationPageBase,
                                Ui_WebBrowserAppearancePage):
--- a/eric7/Preferences/__init__.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Preferences/__init__.py	Mon May 17 19:58:15 2021 +0200
@@ -26,7 +26,7 @@
 
 from PyQt6.QtCore import (
     QDir, QPoint, QLocale, QSettings, QFileInfo, QCoreApplication, QByteArray,
-    QSize, QUrl, Qt, QLibraryInfo, QDateTime
+    QSize, QUrl, Qt, QLibraryInfo, QDateTime, QtMsgType
 )
 from PyQt6.QtGui import QColor, QFont, QPalette
 from PyQt6.QtWidgets import QApplication
@@ -224,11 +224,12 @@
         "DownloadPath": "",
         "RequestDownloadFilename": True,
         "CheckErrorLog": True,
-        "MinimumMessageTypeSeverity": 2,    # 0 = QtDebugMsg
-                                            # 1 = QtWarningMsg
-                                            # 2 = QtCriticalMsg, QtSystemMsg
-                                            # 3 = QtFatalMsg
-        
+        "MinimumMessageTypeSeverity": QtMsgType.QtCriticalMsg.value,
+        # 0 = QtMsgType.QtDebugMsg
+        # 1 = QtMsgType.QtWarningMsg
+        # 2 = QtMsgType.QtCriticalMsg
+        # 3 = QtMsgType.QtFatalMsg
+
         "LogStdErrColour": QColor(Qt.GlobalColor.red),
         "NotificationTimeout": 5,       # time in seconds the notification
                                         # is shown
@@ -368,7 +369,7 @@
         "IndentationGuides": True,
         "LinenoMargin": True,
         "FoldingMargin": True,
-        "FoldingStyle": 1,
+        "FoldingStyle": QsciScintilla.FoldStyle.PlainFoldStyle,
         "TabForIndentation": False,
         "TabIndents": True,
         "ConvertTabsOnLoad": False,
@@ -2097,8 +2098,8 @@
         return prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key])
     elif key in ["AutosaveInterval", "TabWidth", "IndentWidth",
-                 "FoldingStyle", "WarnFilesize", "EdgeColumn",
-                 "CaretWidth", "CaretLineFrameWidth", "AutoCompletionSource",
+                 "WarnFilesize", "EdgeColumn",
+                 "CaretWidth", "CaretLineFrameWidth",
                  "AutoCompletionThreshold", "AutoCompletionTimeout",
                  "AutoCompletionCacheSize", "AutoCompletionCacheTime",
                  "AutoCompletionWatchdogTime", "AutoCompletionMaxLines",
@@ -2113,32 +2114,35 @@
         return int(prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key]))
     elif key == "WrapLongLinesMode":
-        return QsciScintilla.WrapMode(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "WrapVisualFlag":
-        return QsciScintilla.WrapVisualFlag(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "WrapIndentMode":
-        return QsciScintilla.WrapIndentMode(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "EdgeMode":
-        return QsciScintilla.EdgeMode(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "CallTipsStyle":
-        return QsciScintilla.CallTipsStyle(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "AutoCompletionSource":
-        return QsciScintilla.AutoCompletionSource(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "PythonBadIndentation":
-        return QsciLexerPython.IndentationWarning(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "EOLMode":
-        return QsciScintilla.EolMode(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key == "CallTipsPosition":
-        return QsciScintilla.CallTipsPosition(int(prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key].value)))
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
+    elif key == "FoldingStyle":
+        return prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key])
     elif key in ["AdditionalOpenFilters", "AdditionalSaveFilters",
                  "PreviewMarkdownFileNameExtensions",
                  "PreviewRestFileNameExtensions",
@@ -2169,12 +2173,13 @@
     """
     if key == "TabIndentOverride":
         prefClass.settings.setValue("Editor/" + key, json.dumps(value))
-    elif key in ("WrapLongLinesMode", "WrapVisualFlag", "WrapIndentMode",
-                 "EdgeMode", "CallTipsStyle", "AutoCompletionSource",
-                 "PythonBadIndentation", "EOLMode", "CallTipsPosition"):
-        # value is an enum.Enum derived item
-        prefClass.settings.setValue("Editor/" + key, value.value)
-    else:
+##    elif key in ("WrapLongLinesMode", "WrapVisualFlag", "WrapIndentMode",
+##                 "EdgeMode", "CallTipsStyle", "AutoCompletionSource",
+##                 "PythonBadIndentation", "EOLMode", "CallTipsPosition",
+##                 "FoldingStyle"):
+##        # value is an enum.Enum derived item
+##        prefClass.settings.setValue("Editor/" + key, value.value)
+##    else:
         prefClass.settings.setValue("Editor/" + key, value)
     
 
--- a/eric7/QScintilla/Editor.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/QScintilla/Editor.py	Mon May 17 19:58:15 2021 +0200
@@ -535,7 +535,8 @@
             self.__changeBreakPoints)
         self.breakpointModel.rowsInserted.connect(
             self.__addBreakPoints)
-        self.SCN_MODIFIED.connect(self.__modified)
+        # FIXME: C++ type 'const char*' is not supported as a signal argument type
+##        self.SCN_MODIFIED.connect(self.__modified)
         
         # establish connection to some ViewManager action groups
         self.addActions(self.vm.editorActGrp.actions())
@@ -4721,12 +4722,12 @@
         self.setAutoCompletionReplaceWord(
             Preferences.getEditor("AutoCompletionReplaceWord"))
         self.setAutoCompletionThreshold(0)
-        try:
+        if Preferences.getEditor("AutoCompletionShowSingle"):
             self.setAutoCompletionUseSingle(
-                Preferences.getEditor("AutoCompletionShowSingle"))
-        except AttributeError:
-            self.setAutoCompletionShowSingle(
-                Preferences.getEditor("AutoCompletionShowSingle"))
+                QsciScintilla.AutoCompletionUseSingle.AcusAlways)
+        else:
+            self.setAutoCompletionUseSingle(
+                QsciScintilla.AutoCompletionUseSingle.AcusNever)
         autoCompletionSource = Preferences.getEditor("AutoCompletionSource")
         if (
             autoCompletionSource ==
@@ -5461,9 +5462,9 @@
             elif self.__marginNumber(evt.x()) == self.__bpMargin:
                 self.bpMarginMenu.popup(evt.globalPos())
             elif self.__marginNumber(evt.x()) == self.__indicMargin:
-                self.indicMarginMenu.popup(evt.globalPos())
+                self.indicMarginMenu.popup(evt.globalPos)
             elif self.__marginNumber(evt.x()) == self.__foldMargin:
-                self.foldMarginMenu.popup(evt.globalPos())
+                self.foldMarginMenu.popup(evt.globalPos)
         
     def __showContextMenu(self):
         """
@@ -8414,7 +8415,7 @@
         """
         modifiers = evt.modifiers()
         button = evt.button()
-        key = (int(modifiers), int(button))
+        key = (modifiers.value, button.value)
         
         self.vm.eventFilter(self, evt)
         super().mouseReleaseEvent(evt)
--- a/eric7/Sessions/SessionFile.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/Sessions/SessionFile.py	Mon May 17 19:58:15 2021 +0200
@@ -10,7 +10,7 @@
 import json
 import time
 
-from PyQt6.QtCore import QObject
+from PyQt6.QtCore import Qt, QObject
 
 from E5Gui import E5MessageBox
 from E5Gui.E5OverrideCursor import E5OverridenCursor
@@ -86,7 +86,7 @@
         if vm.canSplit():
             sessionDict["ViewManagerSplits"] = {
                 "Count": vm.splitCount(),
-                "Orientation": vm.getSplitOrientation(),
+                "Orientation": vm.getSplitOrientation().value,
             }
         else:
             sessionDict["ViewManagerSplits"] = {
@@ -281,7 +281,9 @@
         
         # step 2: (project) filenames and the active editor
         # =================================================
-        vm.setSplitOrientation(sessionDict["ViewManagerSplits"]["Orientation"])
+        vm.setSplitOrientation(
+            Qt.Orientation(sessionDict["ViewManagerSplits"]["Orientation"])
+        )
         vm.setSplitCount(sessionDict["ViewManagerSplits"]["Count"])
         
         editorsDict = {}
--- a/eric7/UI/NotificationWidget.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/UI/NotificationWidget.py	Mon May 17 19:58:15 2021 +0200
@@ -262,7 +262,7 @@
         
         if evt.button() == Qt.MouseButton.LeftButton:
             self.__dragPosition = (
-                evt.globalPos() - self.frameGeometry().topLeft()
+                evt.globalPosition().toPoint() - self.frameGeometry().topLeft()
             )
             self.setCursor(Qt.CursorShape.ClosedHandCursor)
             evt.accept()
@@ -286,5 +286,5 @@
         @param evt reference to the mouse event (QMouseEvent)
         """
         if evt.buttons() & Qt.MouseButton.LeftButton:
-            self.move(evt.globalPos() - self.__dragPosition)
+            self.move(evt.globalPosition().toPoint() - self.__dragPosition)
             evt.accept()
--- a/eric7/UI/UserInterface.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/UI/UserInterface.py	Mon May 17 19:58:15 2021 +0200
@@ -7349,7 +7349,7 @@
                 None,
                 self.tr("Select Workspace Directory"),
                 default,
-                E5FileDialog.Options(E5FileDialog.Option(0)))
+                E5FileDialog.Option(0))
             Preferences.setMultiProject("Workspace", workspace)
     
     def versionIsNewer(self, required, snapshot=None):
--- a/eric7/WebBrowser/AutoScroll/AutoScroller.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/WebBrowser/AutoScroll/AutoScroller.py	Mon May 17 19:58:15 2021 +0200
@@ -69,7 +69,7 @@
             rect = self.__indicatorGlobalRect()
             xlen = 0
             ylen = 0
-            egp = evt.globalPos()
+            egp = evt.globalPosition().toPoint()
             
             if rect.left() > egp.x():
                 xlen = egp.x() - rect.left()
@@ -125,7 +125,7 @@
         """
         if self.__enabled and self.__indicator.isVisible():
             if not self.__indicatorGlobalRect().contains(
-                    evt.globalPos()):
+                    evt.globalPosition().toPoint()):
                 self.__stopScrolling()
             return True
         
--- a/eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/WebBrowser/SafeBrowsing/SafeBrowsingLabel.py	Mon May 17 19:58:15 2021 +0200
@@ -47,7 +47,7 @@
         @param evt reference to the mouse event (QMouseEvent)
         """
         if evt.button() == Qt.MouseButton.LeftButton:
-            self.clicked.emit(evt.globalPos())
+            self.clicked.emit(evt.globalPosition().toPoint())
         else:
             super().mouseReleaseEvent(evt)
     
@@ -58,7 +58,7 @@
         @param evt reference to the mouse event (QMouseEvent)
         """
         if evt.button() == Qt.MouseButton.LeftButton:
-            self.clicked.emit(evt.globalPos())
+            self.clicked.emit(evt.globalPosition().toPoint())
         else:
             super().mouseDoubleClickEvent(evt)
     
--- a/eric7/WebBrowser/UrlBar/FavIconLabel.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/WebBrowser/UrlBar/FavIconLabel.py	Mon May 17 19:58:15 2021 +0200
@@ -76,7 +76,7 @@
         @param evt reference to the mouse event (QMouseEvent)
         """
         if evt.button() == Qt.MouseButton.LeftButton:
-            self.__showPopup(evt.globalPos())
+            self.__showPopup(evt.globalPosition().toPoint())
         super().mouseReleaseEvent(evt)
     
     def mouseMoveEvent(self, evt):
--- a/eric7/WebBrowser/UrlBar/UrlBar.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/WebBrowser/UrlBar/UrlBar.py	Mon May 17 19:58:15 2021 +0200
@@ -349,20 +349,16 @@
             not currentText.lower().startswith(("http://", "https://"))
         ):
             append = ""
-            if evt.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.ControlModifier
-            ):
+            if evt.modifiers() == Qt.KeyboardModifier.ControlModifier:
                 append = ".com"
             elif (
-                evt.modifiers() == Qt.KeyboardModifiers(
+                evt.modifiers() == (
                     Qt.KeyboardModifier.ControlModifier |
                     Qt.KeyboardModifier.ShiftModifier
                 )
             ):
                 append = ".org"
-            elif evt.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.ShiftModifier
-            ):
+            elif evt.modifiers() == Qt.KeyboardModifier.ShiftModifier:
                 append = ".net"
             
             if append != "":
--- a/eric7/WebBrowser/WebBrowserWindow.py	Sun May 16 20:07:24 2021 +0200
+++ b/eric7/WebBrowser/WebBrowserWindow.py	Mon May 17 19:58:15 2021 +0200
@@ -4491,17 +4491,13 @@
             number = 10
         
         if number != -1:
-            if evt.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.AltModifier
-            ):
+            if evt.modifiers() == Qt.KeyboardModifier.AltModifier:
                 if number == 10:
                     number = self.__tabWidget.count()
                 self.__tabWidget.setCurrentIndex(number - 1)
                 return
             
-            if evt.modifiers() == Qt.KeyboardModifiers(
-                Qt.KeyboardModifier.MetaModifier
-            ):
+            if evt.modifiers() == Qt.KeyboardModifier.MetaModifier:
                 url = self.speedDial().urlForShortcut(number - 1)
                 if url.isValid():
                     self.__linkActivated(url)

eric ide

mercurial