src/eric7/CodeFormatting/IsortFormattingDialog.py

branch
eric7
changeset 9465
8a020c34dce2
parent 9460
0d1b5d0fd815
child 9468
a4d8091cd8f7
diff -r cbbeebc5c5dd -r 8a020c34dce2 src/eric7/CodeFormatting/IsortFormattingDialog.py
--- a/src/eric7/CodeFormatting/IsortFormattingDialog.py	Thu Nov 03 15:25:21 2022 +0100
+++ b/src/eric7/CodeFormatting/IsortFormattingDialog.py	Thu Nov 03 17:51:03 2022 +0100
@@ -79,14 +79,26 @@
 
         self.resultsList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder)
 
+        self.__project = project
+
         self.__config = copy.deepcopy(configuration)
         self.__config["quiet"] = True  # we don't want extra output
         self.__config["overwrite_in_place"] = True  # we want to overwrite the files
         if "config_source" in self.__config:
             del self.__config["config_source"]
-        self.__isortConfig = Config(**self.__config)
+
+        # Create an isort Config object and pre-load it with parameters contained in
+        # project specific configuration files (like pyproject.toml). The configuration
+        # given as a dictionary (i.e. data entered in the configuration dialog)
+        # overwrites these. If the project is not passed, the isort config is based on
+        # the isort defaults.
+        self.__isortConfig = (
+            Config(settings_path=project.getProjectPath(), **self.__config)
+            if project
+            else Config(**self.__config)
+        )
+
         self.__config["__action__"] = action  # needed by the workers
-        self.__project = project
 
         self.__filesList = filesList[:]
 
@@ -363,9 +375,6 @@
         if status != "skipped":
             self.__statistics.processedCount += 1
 
-        if self.__project:
-            filename = self.__project.getRelativePath(filename)
-
         itm = QTreeWidgetItem(
             self.resultsList,
             [

eric ide

mercurial