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

Tue, 20 Dec 2022 16:45:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 20 Dec 2022 16:45:00 +0100
branch
eric7
changeset 111
e0bf42d8474e
parent 110
e6a732fe8270
child 112
fba59e114671

Adapted some import statements to eric 23.1 and newer.

ChangeLog file | annotate | diff | comparison | revisions
PluginTimeTracker.epj file | annotate | diff | comparison | revisions
PluginTimeTracker.py file | annotate | diff | comparison | revisions
PluginTimeTracker.zip file | annotate | diff | comparison | revisions
TimeTracker/TimeTrackEntry.py file | annotate | diff | comparison | revisions
TimeTracker/TimeTracker.py file | annotate | diff | comparison | revisions
TimeTracker/TimeTrackerEntryDialog.py file | annotate | diff | comparison | revisions
TimeTracker/TimeTrackerWidget.py file | annotate | diff | comparison | revisions
pyproject.toml file | annotate | diff | comparison | revisions
--- a/ChangeLog	Mon Oct 24 18:11:34 2022 +0200
+++ b/ChangeLog	Tue Dec 20 16:45:00 2022 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 10.2.0
+- adapted some import statements to eric 23.1 and newer
+
 Version 10.1.0
 - adapted the import statements to the new structure
 
--- a/PluginTimeTracker.epj	Mon Oct 24 18:11:34 2022 +0200
+++ b/PluginTimeTracker.epj	Tue Dec 20 16:45:00 2022 +0100
@@ -192,7 +192,8 @@
       "TimeTracker/Documentation/LICENSE.GPL3",
       "TimeTracker/Documentation/source",
       "TimeTracker/icons/clock-dark.svg",
-      "TimeTracker/icons/clock-light.svg"
+      "TimeTracker/icons/clock-light.svg",
+      "pyproject.toml"
     ],
     "OTHERTOOLSPARMS": {
       "Black": {
@@ -210,6 +211,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/PluginTimeTracker.py	Mon Oct 24 18:11:34 2022 +0200
+++ b/PluginTimeTracker.py	Tue Dec 20 16:45:00 2022 +0100
@@ -9,11 +9,10 @@
 
 import os
 
-from PyQt6.QtCore import QObject, QTranslator, QCoreApplication
+from PyQt6.QtCore import QCoreApplication, QObject, QTranslator
 
 from eric7 import Preferences
 from eric7.EricWidgets.EricApplication import ericApp
-
 from TimeTracker.TimeTracker import TimeTracker
 
 # Start-Of-Header
@@ -21,7 +20,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "10.1.0"
+version = "10.2.0"
 className = "TimeTrackerPlugin"
 packageName = "TimeTracker"
 shortDescription = "Time Tracker to keep track of the project time."
Binary file PluginTimeTracker.zip has changed
--- a/TimeTracker/TimeTrackEntry.py	Mon Oct 24 18:11:34 2022 +0200
+++ b/TimeTracker/TimeTrackEntry.py	Tue Dec 20 16:45:00 2022 +0100
@@ -7,7 +7,7 @@
 Module implementing the time track entry class.
 """
 
-from PyQt6.QtCore import Qt, QDateTime, QTime
+from PyQt6.QtCore import QDateTime, Qt, QTime
 
 
 class TimeTrackEntry:
--- a/TimeTracker/TimeTracker.py	Mon Oct 24 18:11:34 2022 +0200
+++ b/TimeTracker/TimeTracker.py	Tue Dec 20 16:45:00 2022 +0100
@@ -10,13 +10,14 @@
 import json
 import os
 
-from PyQt6.QtCore import Qt, QObject
+from PyQt6.QtCore import QObject, Qt
 from PyQt6.QtGui import QKeySequence
 
 try:
     from eric7.EricGui import EricPixmapCache
 except ImportError:
     from UI import PixmapCache as EricPixmapCache
+
 from eric7.EricGui.EricAction import EricAction
 from eric7.EricWidgets import EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
--- a/TimeTracker/TimeTrackerEntryDialog.py	Mon Oct 24 18:11:34 2022 +0200
+++ b/TimeTracker/TimeTrackerEntryDialog.py	Tue Dec 20 16:45:00 2022 +0100
@@ -7,7 +7,7 @@
 Module implementing the time tracker edit dialog.
 """
 
-from PyQt6.QtCore import pyqtSlot, QDateTime, QDate
+from PyQt6.QtCore import QDate, QDateTime, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
 
 from .Ui_TimeTrackerEntryDialog import Ui_TimeTrackerEntryDialog
--- a/TimeTracker/TimeTrackerWidget.py	Mon Oct 24 18:11:34 2022 +0200
+++ b/TimeTracker/TimeTrackerWidget.py	Tue Dec 20 16:45:00 2022 +0100
@@ -9,12 +9,23 @@
 
 import os
 
-from PyQt6.QtCore import pyqtSlot, QPoint, Qt, QDate, QTime, QFileInfo
+from PyQt6.QtCore import QDate, QFileInfo, QPoint, Qt, QTime, pyqtSlot
 from PyQt6.QtGui import QCursor
-from PyQt6.QtWidgets import QWidget, QMenu, QTreeWidgetItem, QDialog
+from PyQt6.QtWidgets import QDialog, QMenu, QTreeWidgetItem, QWidget
+
+from eric7 import Preferences
+from eric7.EricWidgets import EricFileDialog, EricMessageBox
 
-from eric7 import Preferences, Utilities
-from eric7.EricWidgets import EricMessageBox, EricFileDialog
+try:
+    from eric7.SystemUtilities.FileSystemUtilities import toNativeSeparators
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Utilities import toNativeSeparators
+try:
+    from eric7.SystemUtilities.OSUtilities import getHomeDir
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Utilities import getHomeDir
 
 from .Ui_TimeTrackerWidget import Ui_TimeTrackerWidget
 
@@ -247,7 +258,7 @@
         """
         Private slot to import tracker entries.
         """
-        path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir()
+        path = Preferences.getMultiProject("Workspace") or getHomeDir()
         fname = EricFileDialog.getOpenFileName(
             None,
             self.tr("Import Time Tracker Entries"),
@@ -255,7 +266,7 @@
             self.tr("Time Tracker Files (*.ttj);;All Files (*)"),
         )
         if fname:
-            fname = Utilities.toNativeSeparators(fname)
+            fname = toNativeSeparators(fname)
             if not os.path.exists(fname):
                 EricMessageBox.critical(
                     self,
@@ -273,7 +284,7 @@
         @param ids list of IDs to export or all if empty
         @type list of int
         """
-        path = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir()
+        path = Preferences.getMultiProject("Workspace") or getHomeDir()
         fname, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
             self,
             self.tr("Export Time Tracker Entries"),
@@ -299,7 +310,7 @@
                 )
                 if not res:
                     return
-                fname = Utilities.toNativeSeparators(fname)
+                fname = toNativeSeparators(fname)
             self.__tracker.saveTrackerEntries(filePath=fname, ids=ids)
 
     def __exportSelectedEntries(self):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyproject.toml	Tue Dec 20 16:45:00 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 = ["TimeTracker", "eric7"]

eric ide

mercurial