( self, root )
| 159 | # new definition are all adjusted to be relative to the requested |
| 160 | # root. |
| 161 | def reRooted( self, root ) : |
| 162 | |
| 163 | if not root: |
| 164 | return MenuDefinition( [] ) |
| 165 | |
| 166 | rootConformed = "/{}/".format( root.strip('/') ) |
| 167 | |
| 168 | newItems = [] |
| 169 | for path, itemDict in self.items() : |
| 170 | if path.startswith( rootConformed ) : |
| 171 | newItems.append( ( path[ len( rootConformed )-1 : ], itemDict ) ) |
| 172 | |
| 173 | return MenuDefinition( newItems ) |
| 174 | |
| 175 | ## Returns the item at `path`. Supports multiple path components. |
| 176 | # If no item is found, return `None` |
no test coverage detected