Adapted some import statements to eric 23.1 and newer. eric7 release-10.3.0

Wed, 21 Dec 2022 10:12:45 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 21 Dec 2022 10:12:45 +0100
branch
eric7
changeset 164
277a93891db9
parent 163
e3ed5e2856d7
child 165
ad6821366ef7

Adapted some import statements to eric 23.1 and newer.

ChangeLog file | annotate | diff | comparison | revisions
PluginProjectPyramid.py file | annotate | diff | comparison | revisions
PluginProjectPyramid.zip file | annotate | diff | comparison | revisions
PluginPyramid.epj file | annotate | diff | comparison | revisions
ProjectPyramid/ConfigurationPage/PyramidPage.py file | annotate | diff | comparison | revisions
ProjectPyramid/DistributionTypeSelectionDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/MigrateSummaryDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/Project.py file | annotate | diff | comparison | revisions
ProjectPyramid/PyramidDialog.py file | annotate | diff | comparison | revisions
ProjectPyramid/PyramidRoutesDialog.py file | annotate | diff | comparison | revisions
pyproject.toml file | annotate | diff | comparison | revisions
--- a/ChangeLog	Sat Nov 26 18:02:44 2022 +0100
+++ b/ChangeLog	Wed Dec 21 10:12:45 2022 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 10.3.0
+- adapted some import statements to eric 23.1 and newer
+
 Version 10.2.0:
 - adapted to the project browser changes as of eric 22.12
 
--- a/PluginProjectPyramid.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/PluginProjectPyramid.py	Wed Dec 21 10:12:45 2022 +0100
@@ -7,15 +7,20 @@
 Module implementing the Pyramid project plugin.
 """
 
-import os
+import fnmatch
 import glob
-import fnmatch
+import os
 
 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator
 
 from eric7 import Preferences
 from eric7.EricWidgets.EricApplication import ericApp
-from eric7.Globals import isWindowsPlatform, isMacPlatform
+
+try:
+    from eric7.SystemUtilities.OSUtilities import isMacPlatform, isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform, isMacPlatform
 
 from ProjectPyramid.Project import Project
 
@@ -24,7 +29,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "10.2.0"
+version = "10.3.0"
 className = "ProjectPyramidPlugin"
 packageName = "ProjectPyramid"
 shortDescription = "Project support for Pyramid projects."
@@ -194,10 +199,10 @@
         try:
             # backward compatibility for eric7 < 22.12
             from eric7.Project.ProjectBrowser import (
+                FormsBrowserFlag,
+                OthersBrowserFlag,
                 SourcesBrowserFlag,
-                FormsBrowserFlag,
                 TranslationsBrowserFlag,
-                OthersBrowserFlag,
             )
 
             Preferences.setProjectBrowserFlagsDefault(
Binary file PluginProjectPyramid.zip has changed
--- a/PluginPyramid.epj	Sat Nov 26 18:02:44 2022 +0100
+++ b/PluginPyramid.epj	Wed Dec 21 10:12:45 2022 +0100
@@ -240,7 +240,8 @@
       "ProjectPyramid/icons/pyramid-dark.svg",
       "ProjectPyramid/icons/pyramid-light.svg",
       "ProjectPyramid/icons/pyramid64-dark.svg",
-      "ProjectPyramid/icons/pyramid64-light.svg"
+      "ProjectPyramid/icons/pyramid64-light.svg",
+      "pyproject.toml"
     ],
     "OTHERTOOLSPARMS": {
       "Black": {
@@ -258,6 +259,23 @@
           "py38",
           "py37"
         ]
+      },
+      "isort": {
+        "combine_as_imports": true,
+        "config_source": "project",
+        "extend_skip_glob": [
+          "*/Ui_*.py"
+        ],
+        "lines_between_types": 1,
+        "profile": "black",
+        "sort_order": "natural",
+        "supported_extensions": [
+          "py",
+          "pyi",
+          "pyx",
+          "pxd",
+          "pyw"
+        ]
       }
     },
     "PACKAGERSPARMS": {},
--- a/ProjectPyramid/ConfigurationPage/PyramidPage.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/ConfigurationPage/PyramidPage.py	Wed Dec 21 10:12:45 2022 +0100
@@ -15,11 +15,16 @@
     from UI import PixmapCache as EricPixmapCache
 from eric7.EricWidgets.EricApplication import ericApp
 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
-from eric7.Globals import isWindowsPlatform, isMacPlatform
 from eric7.Preferences.ConfigurationPages.ConfigurationPageBase import (
     ConfigurationPageBase,
 )
 
+try:
+    from eric7.SystemUtilities.OSUtilities import isMacPlatform, isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform, isMacPlatform
+
 from .Ui_PyramidPage import Ui_PyramidPage
 
 
--- a/ProjectPyramid/DistributionTypeSelectionDialog.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/DistributionTypeSelectionDialog.py	Wed Dec 21 10:12:45 2022 +0100
@@ -7,7 +7,7 @@
 Module implementing a dialog to select the distribution file formats.
 """
 
-from PyQt6.QtCore import Qt, QProcess
+from PyQt6.QtCore import QProcess, Qt
 from PyQt6.QtWidgets import QDialog, QListWidgetItem
 
 from eric7 import Preferences
--- a/ProjectPyramid/MigrateSummaryDialog.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/MigrateSummaryDialog.py	Wed Dec 21 10:12:45 2022 +0100
@@ -7,14 +7,14 @@
 Module implementing a dialog showing a summary of all created.migrations.
 """
 
-from PyQt6.QtCore import pyqtSlot, Qt, QProcess, QEventLoop, QTimer
+from PyQt6.QtCore import QEventLoop, QProcess, Qt, QTimer, pyqtSlot
 from PyQt6.QtGui import QGuiApplication
 from PyQt6.QtWidgets import (
+    QAbstractButton,
+    QAbstractItemView,
     QDialog,
     QDialogButtonBox,
-    QAbstractButton,
     QTreeWidgetItem,
-    QAbstractItemView,
 )
 
 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor
--- a/ProjectPyramid/Project.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/Project.py	Wed Dec 21 10:12:45 2022 +0100
@@ -15,16 +15,36 @@
 import subprocess  # secok
 import sys
 
-from PyQt6.QtCore import pyqtSlot, QObject, QFileInfo, QTimer, QUrl, QIODeviceBase
+from PyQt6.QtCore import (
+    QFileInfo,
+    QIODeviceBase,
+    QObject,
+    QProcess as QProcessPyQt,
+    QTimer,
+    QUrl,
+    pyqtSlot,
+)
 from PyQt6.QtGui import QDesktopServices
-from PyQt6.QtWidgets import QMenu, QDialog, QInputDialog, QLineEdit
-from PyQt6.QtCore import QProcess as QProcessPyQt
+from PyQt6.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu
 
 from eric7 import Preferences, Utilities
 from eric7.EricGui.EricAction import EricAction
+from eric7.EricWidgets import EricFileDialog, EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
-from eric7.EricWidgets import EricMessageBox, EricFileDialog
-from eric7.Globals import isWindowsPlatform
+
+try:
+    from eric7.SystemUtilities.FileSystemUtilities import (
+        getExecutablePath,
+        getExecutablePaths,
+    )
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Utilities import getExecutablePath, getExecutablePaths
+try:
+    from eric7.SystemUtilities.OSUtilities import isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform
 
 try:
     from eric7.EricGui import EricPixmapCache
@@ -840,7 +860,7 @@
                 else:
                     if cmd:
                         try:
-                            fullCmds = Utilities.getExecutablePaths(cmd)
+                            fullCmds = getExecutablePaths(cmd)
                         except AttributeError:
                             fullCmds = self.__getExecutablePaths(cmd)
                         for fullCmd in fullCmds:
@@ -973,7 +993,7 @@
             fullCmds = [
                 os.path.join(virtualEnv, "bin", cmd),
                 os.path.join(virtualEnv, "local", "bin", cmd),
-                Utilities.getExecutablePath(cmd),
+                getExecutablePath(cmd),
                 cmd,  # fall back to just cmd
             ]
             for cmd in fullCmds:
@@ -1421,7 +1441,7 @@
                 return
 
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(
                 self.getPyramidCommand(
                     "pserve", virtualEnv=self.getProjectVirtualEnvironment()
@@ -1522,7 +1542,7 @@
                 return
 
             args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
+            args[0] = getExecutablePath(args[0])
             args.append(
                 self.getPyramidCommand(
                     "pshell", virtualEnv=self.getProjectVirtualEnvironment()
--- a/ProjectPyramid/PyramidDialog.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/PyramidDialog.py	Wed Dec 21 10:12:45 2022 +0100
@@ -9,12 +9,18 @@
 
 import os
 
-from PyQt6.QtCore import QProcess, QTimer, pyqtSlot, Qt, QCoreApplication
+from PyQt6.QtCore import QCoreApplication, QProcess, Qt, QTimer, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLineEdit, QTextEdit
 
 from eric7 import Preferences
 from eric7.EricWidgets import EricMessageBox
-from eric7.Globals import isWindowsPlatform, isMacPlatform, strToQByteArray
+from eric7.Globals import strToQByteArray
+
+try:
+    from eric7.SystemUtilities.OSUtilities import isMacPlatform, isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform, isMacPlatform
 
 from .Ui_PyramidDialog import Ui_PyramidDialog
 
--- a/ProjectPyramid/PyramidRoutesDialog.py	Sat Nov 26 18:02:44 2022 +0100
+++ b/ProjectPyramid/PyramidRoutesDialog.py	Wed Dec 21 10:12:45 2022 +0100
@@ -9,7 +9,7 @@
 
 import os
 
-from PyQt6.QtCore import pyqtSlot, Qt, QProcess, QTimer, QCoreApplication
+from PyQt6.QtCore import QCoreApplication, QProcess, Qt, QTimer, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLineEdit, QTreeWidgetItem
 
 from eric7 import Preferences
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyproject.toml	Wed Dec 21 10:12:45 2022 +0100
@@ -0,0 +1,10 @@
+[tool.isort]
+profile = "black"
+sort_order = "natural"
+supported_extensions = ["py", "pyi", "pyx", "pxd", "pyw"]
+lines_between_types = 1
+extend_skip_glob = [
+    "*/Ui_*.py",
+]
+combine_as_imports = true
+known_first_party = ["ProjectPyramid", "eric7"]

eric ide

mercurial