The link module¶
Generic Link class and handling of links (clickable areas on a Page).
The link area is in coordinates between 0.0 and 1.0, like Poppler does it. This way we can easily compute where the link area is on a page in different sizes or rotations.
- class Area(left, top, right, bottom)¶
Bases:
tuple
- bottom¶
Alias for field number 3
- left¶
Alias for field number 0
- right¶
Alias for field number 2
- top¶
Alias for field number 1
- class Link(left, top, right, bottom, url=None, tooltip=None)[source]¶
Bases:
object
- fileName = ''¶
- targetPage = -1¶
- area = (0, 0, 0, 0)¶
- url = ''¶
- isExternal = False¶
- tooltip = ''¶
- class Links(objects=None)[source]¶
Bases:
Rectangles
Manages a list of Link objects.
See the rectangles documentation for how to access the links.
- class LinkViewMixin(parent=None, **kwds)[source]¶
Bases:
object
Mixin class to enhance view.View with link capabilities.
- linkHovered¶
(page, link) emitted when the user hovers a link
- linkLeft¶
(no args) emitted when the user does not hover a link anymore
- linkClicked¶
(event, page, link) emitted when the user clicks a link
- linkHelpRequested¶
(event, page, link) emitted when a What’s This or Toolip is requested. The event’s type determines the type of this help event.
- linksEnabled = True¶
whether to actually enable Link handling
- setLinkHighlighter(highlighter)[source]¶
Sets a Highlighter (see highlight.py) to highlight a link on hover.
Use None to remove an active Highlighter. By default no highlighter is set to highlight links on hover.
To be able to actually use highlighting, be sure to also mix in the HighlightViewMixin class from the highlight module.
- linkHighlighter()[source]¶
Return the currently set Highlighter, if any.
By default no highlighter is set to highlight links on hover, and None is returned in that case.
- adjustCursor(pos)[source]¶
Adjust the cursor if pos is on a link (and linksEnabled is True).
Also emits signals when the cursor enters or leaves a link.
- linkAt(pos)[source]¶
If the pos (in the viewport) is over a link, return a (page, link) tuple.
Otherwise returns (None, None).
- linkHoverEnter(page, link)[source]¶
Called when the mouse hovers over a link.
The default implementation emits the linkHovered(page, link) signal, sets a pointing hand mouse cursor, and, if a Highlighter was set using setLinkHighlighter(), highlights the link. You can reimplement this method to do something different.
- linkHoverLeave()[source]¶
Called when the mouse does not hover a link anymore.
The default implementation emits the linkLeft() signal, sets a default mouse cursor, and, if a Highlighter was set using setLinkHighlighter(), removes the highlighting of the current link. You can reimplement this method to do something different.
- linkClickEvent(ev, page, link)[source]¶
Called when a link is clicked.
The default implementation emits the linkClicked(event, page, link) signal. The event can be used for things like determining which button was used, and which keyboard modifiers were in effect.