eric7/Preferences/__init__.py

branch
eric7
changeset 8318
962bce857696
parent 8314
e3642a6a1e71
child 8319
ea11a3948f40
--- a/eric7/Preferences/__init__.py	Sun May 16 11:43:59 2021 +0200
+++ b/eric7/Preferences/__init__.py	Sun May 16 20:07:24 2021 +0200
@@ -24,17 +24,17 @@
 import sys
 import contextlib
 
-from PyQt5.QtCore import (
+from PyQt6.QtCore import (
     QDir, QPoint, QLocale, QSettings, QFileInfo, QCoreApplication, QByteArray,
     QSize, QUrl, Qt, QLibraryInfo, QDateTime
 )
-from PyQt5.QtGui import QColor, QFont, QPalette
-from PyQt5.QtWidgets import QApplication
+from PyQt6.QtGui import QColor, QFont, QPalette
+from PyQt6.QtWidgets import QApplication
 try:
-    from PyQt5.QtWebEngineWidgets import QWebEngineSettings
+    from PyQt6.QtWebEngineWidgets import QWebEngineSettings
 except ImportError:
     QWebEngineSettings = None
-from PyQt5.Qsci import QsciScintilla, QsciLexerPython
+from PyQt6.Qsci import QsciScintilla, QsciLexerPython
 
 from E5Gui import E5FileDialog
 
@@ -205,12 +205,12 @@
         "ProxyAccount/Ftp": "",
         "ProxyExceptions": "localhost,127.0.0.,::1",
         
-        "PluginRepositoryUrl6":
-        "https://eric-ide.python-projects.org/plugins6/repository.xml",
-        "VersionsUrls6": [
-            "https://eric-ide.python-projects.org/versions/versions6",
+        "PluginRepositoryUrl7":
+        "https://eric-ide.python-projects.org/plugins7/repository.xml",
+        "VersionsUrls7": [
+            "https://eric-ide.python-projects.org/versions/versions7",
             "https://die-offenbachs.homelinux.org/eric/versions/"
-            "versions6",
+            "versions7",
         ],
         
         "OpenOnStartup": 0,        # 0 = nothing
@@ -427,6 +427,7 @@
         "CallTipsEnabled": False,
         "CallTipsVisible": 0,
         "CallTipsStyle": QsciScintilla.CallTipsStyle.CallTipsNoContext,
+        "CallTipsPosition": QsciScintilla.CallTipsPosition.CallTipsBelowText,
         # show QScintilla calltips, if plug-in fails
         "CallTipsScintillaOnFail": False,
         
@@ -633,14 +634,6 @@
     else:
         editorDefaults["EOLMode"] = QsciScintilla.EolMode.EolUnix
     
-    try:
-        # since QScintilla 2.7.0
-        editorDefaults["CallTipsPosition"] = (
-            QsciScintilla.CallTipsPosition.CallTipsBelowText
-        )
-    except AttributeError:
-        editorDefaults["CallTipsPosition"] = 0
-    
     editorColourDefaults = {
         "CurrentMarker": QColor(Qt.GlobalColor.yellow),
         "ErrorMarker": QColor(Qt.GlobalColor.red),
@@ -1613,9 +1606,6 @@
         dn.mkdir(".eric7")
     QCoreApplication.setOrganizationName(Globals.settingsNameOrganization)
     QCoreApplication.setApplicationName(Globals.settingsNameGlobal)
-    with contextlib.suppress(AttributeError):
-        Prefs.settings.setAtomicSyncRequired(False)
-        # backward compatibility for Qt < 5.10
     
     Prefs.settings.value("UI/SingleApplicationMode")
     
@@ -1978,7 +1968,7 @@
             return state
         else:
             return prefClass.uiDefaults[key]
-    elif key in ["VersionsUrls6"]:
+    elif key in ["VersionsUrls7"]:
         urls = toList(
             prefClass.settings.value("UI/" + key, prefClass.uiDefaults[key]))
         if len(urls) == 0:
@@ -2107,22 +2097,48 @@
         return prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key])
     elif key in ["AutosaveInterval", "TabWidth", "IndentWidth",
-                 "FoldingStyle", "WarnFilesize", "EdgeMode", "EdgeColumn",
+                 "FoldingStyle", "WarnFilesize", "EdgeColumn",
                  "CaretWidth", "CaretLineFrameWidth", "AutoCompletionSource",
                  "AutoCompletionThreshold", "AutoCompletionTimeout",
                  "AutoCompletionCacheSize", "AutoCompletionCacheTime",
                  "AutoCompletionWatchdogTime", "AutoCompletionMaxLines",
                  "AutoCompletionMaxChars", "CallTipsVisible",
-                 "CallTipsStyle", "MarkOccurrencesTimeout", "SearchRegexpMode",
+                 "MarkOccurrencesTimeout", "SearchRegexpMode",
                  "AutoSpellCheckChunkSize", "SpellCheckingMinWordSize",
-                 "PostScriptLevel", "EOLMode", "ZoomFactor", "WhitespaceSize",
+                 "PostScriptLevel", "ZoomFactor", "WhitespaceSize",
                  "OnlineSyntaxCheckInterval", "OnlineChangeTraceInterval",
-                 "WrapLongLinesMode", "WrapVisualFlag", "WrapIndentMode",
-                 "WrapStartIndent", "CallTipsPosition", "VirtualSpaceOptions",
+                 "WrapStartIndent", "VirtualSpaceOptions",
                  "PreviewRefreshWaitTimer", "SourceOutlineWidth",
                  "SourceOutlineStepSize"]:
         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)))
+    elif key == "WrapVisualFlag":
+        return QsciScintilla.WrapVisualFlag(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "WrapIndentMode":
+        return QsciScintilla.WrapIndentMode(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "EdgeMode":
+        return QsciScintilla.EdgeMode(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "CallTipsStyle":
+        return QsciScintilla.CallTipsStyle(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "AutoCompletionSource":
+        return QsciScintilla.AutoCompletionSource(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "PythonBadIndentation":
+        return QsciLexerPython.IndentationWarning(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "EOLMode":
+        return QsciScintilla.EolMode(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
+    elif key == "CallTipsPosition":
+        return QsciScintilla.CallTipsPosition(int(prefClass.settings.value(
+            "Editor/" + key, prefClass.editorDefaults[key].value)))
     elif key in ["AdditionalOpenFilters", "AdditionalSaveFilters",
                  "PreviewMarkdownFileNameExtensions",
                  "PreviewRestFileNameExtensions",
@@ -2131,14 +2147,6 @@
                  "FullSpellCheckExtensions"]:
         return toList(prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key]))
-    elif key in ["PythonBadIndentation"]:
-        value = prefClass.settings.value(
-            "Editor/" + key, prefClass.editorDefaults[key])
-        if value in ["true", "True"]:
-            value = 1
-        elif value in ["false", "False"]:
-            value = 0
-        return QsciLexerPython.IndentationWarning(int(value))
     elif key == "TabIndentOverride":
         overrideStr = prefClass.settings.value(
             "Editor/" + key, prefClass.editorDefaults[key])
@@ -2161,6 +2169,11 @@
     """
     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:
         prefClass.settings.setValue("Editor/" + key, value)
     
@@ -2679,8 +2692,8 @@
         s = os.getenv(key.upper(), "")
     if s == "":
         s = os.path.join(
-            QLibraryInfo.location(
-                QLibraryInfo.LibraryLocation.DocumentationPath),
+            QLibraryInfo.path(
+                QLibraryInfo.LibraryPath.DocumentationPath),
             "qtdoc")
     return s
 
@@ -2959,8 +2972,8 @@
         "Qt/Qt5TranslationsDir",
         prefClass.qtDefaults["Qt5TranslationsDir"])
     if s == "":
-        s = QLibraryInfo.location(
-            QLibraryInfo.LibraryLocation.TranslationsPath)
+        s = QLibraryInfo.path(
+            QLibraryInfo.LibraryPath.TranslationsPath)
     if s == "" and Globals.isWindowsPlatform():
         transPath = os.path.join(Globals.getPyQt5ModulesDirectory(),
                                  "translations")

eric ide

mercurial