Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2114)
+++ ChangeLog	(working copy)
@@ -66,6 +66,15 @@
           Moved:
           def getAcceleratorAndShortcut(obj):
 
+        * src/orca/util.py
+          src/orca/default.py:
+          src/orca/where_am_I.py:
+          src/orca/braillegenerator.py:
+          Another partial fix for bug #395548.
+
+          Moved:
+          def getNodeLevel(obj):
+
 2007-03-05  Rich Burridge <rich.burridge@sun.com>
 
         * src/orca/debug.py:
Index: src/orca/util.py
===================================================================
--- src/orca/util.py	(revision 2114)
+++ src/orca/util.py	(working copy)
@@ -929,44 +929,3 @@
             content = content[:-1]
 
     return [content.encode("UTF-8"), text.caretOffset, startOffset]
-
-def getNodeLevel(obj):
-    """Determines the node level of this object if it is in a tree
-    relation, with 0 being the top level node.  If this object is
-    not in a tree relation, then -1 will be returned.
-
-    Arguments:
-    -obj: the Accessible object
-    """
-
-    if not obj:
-        return -1
-
-    nodes = []
-    node = obj
-    done = False
-    while not done:
-        relations = node.relations
-        node = None
-        for relation in relations:
-            if relation.getRelationType() \
-                   == atspi.Accessibility.RELATION_NODE_CHILD_OF:
-                node = atspi.Accessible.makeAccessible(relation.getTarget(0))
-                break
-
-        # We want to avoid situations where something gives us an
-        # infinite cycle of nodes.  Bon Echo has been seen to do
-        # this (see bug 351847).
-        #
-        if (len(nodes) > 100) or nodes.count(node):
-            debug.println(debug.LEVEL_WARNING,
-                          "util.getNodeLevel detected a cycle!!!")
-            done = True
-        elif node:
-            nodes.append(node)
-            debug.println(debug.LEVEL_FINEST,
-                          "util.getNodeLevel %d" % len(nodes))
-        else:
-            done = True
-
-    return len(nodes) - 1
Index: src/orca/default.py
===================================================================
--- src/orca/default.py	(revision 2114)
+++ src/orca/default.py	(working copy)
@@ -1662,8 +1662,8 @@
                                             rolenames.ROLE_COLUMN_HEADER].speech
                                 utterances.append(text)
 
-            oldNodeLevel = util.getNodeLevel(oldLocusOfFocus)
-            newNodeLevel = util.getNodeLevel(newLocusOfFocus)
+            oldNodeLevel = self.getNodeLevel(oldLocusOfFocus)
+            newNodeLevel = self.getNodeLevel(newLocusOfFocus)
 
             # We'll also treat radio button groups as though they are
             # in a context, with the label for the group being the
@@ -3445,6 +3445,47 @@
 # here so that they can be customized in application scripts if so desired.
 # 
 
+    def getNodeLevel(self, obj):
+        """Determines the node level of this object if it is in a tree
+        relation, with 0 being the top level node.  If this object is
+        not in a tree relation, then -1 will be returned.
+
+        Arguments:
+        -obj: the Accessible object
+        """
+
+        if not obj:
+            return -1
+
+        nodes = []
+        node = obj
+        done = False
+        while not done:
+            relations = node.relations
+            node = None
+            for relation in relations:
+                if relation.getRelationType() \
+                       == atspi.Accessibility.RELATION_NODE_CHILD_OF:
+                    node = atspi.Accessible.makeAccessible(relation.getTarget(0))
+                    break
+
+            # We want to avoid situations where something gives us an
+            # infinite cycle of nodes.  Bon Echo has been seen to do
+            # this (see bug 351847).
+            #
+            if (len(nodes) > 100) or nodes.count(node):
+                debug.println(debug.LEVEL_WARNING,
+                              "Script.getNodeLevel detected a cycle!!!")
+                done = True
+            elif node:
+                nodes.append(node)
+                debug.println(debug.LEVEL_FINEST,
+                              "Script.getNodeLevel %d" % len(nodes))
+            else:
+                done = True
+
+        return len(nodes) - 1
+
     def getAcceleratorAndShortcut(self, obj):
         """Gets the accelerator string (and possibly shortcut) for the given
         object.
Index: src/orca/where_am_I.py
===================================================================
--- src/orca/where_am_I.py	(revision 2114)
+++ src/orca/where_am_I.py	(working copy)
@@ -598,7 +598,7 @@
             text = _("collapsed")
             utterances.append(text)
             
-    level = util.getNodeLevel(orca_state.locusOfFocus)
+    level = orca_state.activeScript.getNodeLevel(orca_state.locusOfFocus)
     if level >= 0:
         utterances.append(_("tree level %d") % (level + 1))
 
Index: src/orca/braillegenerator.py
===================================================================
--- src/orca/braillegenerator.py	(revision 2114)
+++ src/orca/braillegenerator.py	(working copy)
@@ -1068,7 +1068,7 @@
             else:
                 regions[0].append(braille.Region(" " + _("collapsed")))
 
-        level = util.getNodeLevel(obj)
+        level = self._script.getNodeLevel(obj)
         if level >= 0:
             regions[0].append(braille.Region(" " + _("TREE LEVEL %d") \
                                              % (level + 1)))
