src/eric7/Graphics/GraphicsUtilities.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Graphics/GraphicsUtilities.py
--- a/src/eric7/Graphics/GraphicsUtilities.py	Wed Jul 13 11:16:20 2022 +0200
+++ b/src/eric7/Graphics/GraphicsUtilities.py	Wed Jul 13 14:55:47 2022 +0200
@@ -12,18 +12,19 @@
     """
     Unable to calculate result because of recursive structure.
     """
+
     pass
 
 
 def sort(nodes, routes, noRecursion=False):
     """
     Function to sort widgets topographically.
-    
+
     Passed a list of nodes and a list of source, dest routes, it attempts
     to create a list of stages, where each sub list is one stage in a process.
-    
+
     The algorithm was taken from Boa Constructor.
-    
+
     @param nodes list of nodes to be sorted
     @type str
     @param routes list of routes between the nodes
@@ -35,7 +36,7 @@
     @exception RecursionError a recursion error was detected
     """
     children, parents = _buildChildrenLists(routes)
-    
+
     # first stage is those nodes having no incoming routes...
     stage = []
     stages = [stage]
@@ -43,17 +44,17 @@
     for node in nodes:
         if not parents.get(node):
             stage.append(node)
-    
+
     if nodes and not stage:
         # there is no element, which does not depend on some other element!
         stage.append(nodes[0])
-    
+
     taken.extend(stage)
     nodes = list(filter(lambda x, li=stage: x not in li, nodes))
     while nodes:
         previousStageChildren = []
         nodelen = len(nodes)
-        
+
         # second stage are those nodes, which are direct children of the
         # first stage
         for node in stage:
@@ -62,7 +63,7 @@
                     previousStageChildren.append(child)
                 elif child in taken and noRecursion:
                     raise RecursionError((child, node))
-        
+
         # unless they are children of other direct children...
         stage = previousStageChildren
         removes = []
@@ -70,17 +71,17 @@
             currentParents = parents.get(current, [])
             for parent in currentParents:
                 if (
-                    parent in stage and
-                    parent != current and
-                    current not in parents.get(parent, [])
+                    parent in stage
+                    and parent != current
+                    and current not in parents.get(parent, [])
                 ):
                     # is not mutually dependant
                     removes.append(current)
-        
+
         for remove in removes:
             while remove in stage:
                 stage.remove(remove)
-        
+
         stages.append(stage)
         taken.extend(stage)
         nodes = list(filter(lambda x, li=stage: x not in li, nodes))
@@ -90,16 +91,16 @@
             else:
                 stages.append(nodes[:])
                 nodes = []
-    
+
     return stages
-    
+
 
 def _buildChildrenLists(routes):
     """
     Function to build up parent - child relationships.
-    
+
     Taken from Boa Constructor.
-    
+
     @param routes list of routes between nodes
     @type list of tuple of (str, str)
     @return dictionary of child and dictionary of parent relationships

eric ide

mercurial