( self, handle : int, direction : str )
| 118 | |
| 119 | |
| 120 | def UpdateCurrentHierarchy( self, handle : int, direction : str ): |
| 121 | if not self._current_hierarchy.UpdateChangesRoot( handle, direction ): |
| 122 | items = self._ResolveHierarchyItem( handle, direction ) |
| 123 | self._current_hierarchy.UpdateHierarchy( handle, items, direction ) |
| 124 | |
| 125 | if items is not None and direction == 'up': |
| 126 | offset = sum( len( item[ 'locations' ] ) for item in items ) |
| 127 | else: |
| 128 | offset = 0 |
| 129 | |
| 130 | return self._current_hierarchy.HierarchyToLines(), offset |
| 131 | else: |
| 132 | location = self._current_hierarchy.HandleToRootLocation( handle ) |
| 133 | kind = self._current_hierarchy._kind |
| 134 | self._current_hierarchy.Reset() |
| 135 | items = GetRawCommandResponse( |
| 136 | [ f'{ kind.title() }Hierarchy' ], |
| 137 | silent = False, |
| 138 | location = location |
| 139 | ) |
| 140 | # [ 0 ] chooses the data for the 1st (and only) line. |
| 141 | # [ 1 ] chooses only the handle |
| 142 | handle = self.InitializeCurrentHierarchy( items, kind )[ 0 ][ 1 ] |
| 143 | return self.UpdateCurrentHierarchy( handle, direction ) |
| 144 | |
| 145 | |
| 146 | def _ResolveHierarchyItem( self, handle : int, direction : str ): |
nothing calls this directly
no test coverage detected