Most navigational links have three attributes:
A short name such as “Previous” or “Help”.
The link text to be used for this link in the bottom nav links. This is generally the page title or a close approximation; see the discussion of “navigational shock” in the PyStyler documentation.
The destination URL of the link.
There are two principal design complications for navigational links:
Some nav links have multiple destinations. For example, in the TCC help system, some pages list one or more “See also” links: the first is always the parent page in the structure, but additional related pages may be named.
Some links do not appear in the top nav bar. For example, in TCC help system pages, the “See also” links appear only in the bottom nav link section.
So, here's the interface to the NavLink object that represents one navigational link.
# - - - - - c l a s s N a v L i n k - - - - -
class NavLink:
"""Represents one navigational feature with zero or more destinations.
Exports:
NavLink ( shortName, destList=None, noTop=0 ):
[ (shortName is the short name of this feature) and
(destList is a list of (title, url) tuples representing
places this link should point, defaulting to none) and
(noTop is true iff this feature should be omitted from
the top nav bar) ->
return a new NavLink object representing those values
]
.shortName: [ as passed to constructor, read-only ]
.destList: [ as passed to constructor, read-only ]
.noTop: [ as passed to constructor, read-only ]
"""
def __init__ ( self, shortName, destList=None, noTop=0 ):
"""Constructor for NavLink."""
self.shortName = shortName
self.destList = destList
self.noTop = noTop