JBrowser Source Docs
You are reading the documentation for JBrowser 1.4.0. The newest release is 1.5.4. Go to the latest documentation

jbrowser.ui.canvas

Generated from the source code of JBrowser 1.4.0.

jbrowser/ui/canvas.py · 873 lines

The infinite horizontal canvas: cards laid out left→right, panned smoothly, resized with animated transitions, and reporting viewport visibility to the lifecycle manager.

Constants#

Name Value
MARGIN 12
GAP 12
TOP 10
BOTTOM 22
MIN_CARD_W 120
LAYOUT_MS 230
ADD_BTN 44
PULL_DIST 440.0
REVEAL 88.0

EdgePullIndicator#

class EdgePullIndicator(QWidget)source
EdgePullIndicator(canvas: 'Canvas')

The "+" that appears when the canvas is pushed past its first or last card.

It is not a button: it grows with the push and, once the ring is full, the canvas opens a new card at that end. Purely visual, so it never steals clicks from the cards.

EdgePullIndicator.set_state#

set_state(progress: float, fired: bool, hint: str) -> Nonesource

Qt overrides: paintEvent

Minimap#

class Minimap(QWidget)source
Minimap(canvas: 'Canvas')

Overview strip: every card as a segment, the viewport as a highlighted window.

Qt overrides: paintEvent, mousePressEvent, mouseMoveEvent

Canvas#

class Canvas(QWidget)source
Canvas(ctx: 'AppContext', space: Space, ui: 'BrowserController', parent: QWidget)

Canvas.px_width#

px_width(frac: float) -> floatsource

Canvas.targets#

targets() -> dict[str, tuple[float, float]]source

Canvas.content_width#

content_width(targets: dict | None=None) -> floatsource

Canvas.max_offset#

max_offset(targets: dict | None=None) -> floatsource

Canvas.geo#

geo(tab_id: str) -> tuple[float, float] | Nonesource

Canvas.offset#

property offsetsource

Canvas.schedule_layout#

schedule_layout() -> Nonesource

Canvas.request_layout#

request_layout(animated: bool=True) -> Nonesource

Canvas.set_solo#

set_solo(tab_id: str | None) -> Nonesource

Immersive mode: one card fills the whole canvas (HTML5 fullscreen video, etc.).

Canvas.scroll_to#

scroll_to(value: float, animated: bool=True, duration: int=260) -> Nonesource

Canvas.scroll_by#

scroll_by(delta: float, animated: bool=True) -> Nonesource

Canvas.ensure_visible#

ensure_visible(tab_id: str, align: str='nearest', animated: bool=True) -> Nonesource

Canvas.pan_from_wheel#

pan_from_wheel(e) -> Nonesource

Alt + wheel anywhere over the canvas (routed by the window's event filter).

Canvas.edge_nudge#

edge_nudge(side: int) -> Nonesource

Alt+← on the first card / Alt+→ on the last: the first press shows the "+", a second press within a moment adds the card.

Canvas.refresh_visibility#

refresh_visibility() -> Nonesource

Canvas.visible_tab_ids#

visible_tab_ids() -> list[str]source

Qt overrides: resizeEvent, wheelEvent, showEvent, hideEvent, mousePressEvent, keyPressEvent, mouseMoveEvent, paintEvent

SpaceStack#

class SpaceStack(QWidget)source
SpaceStack(ctx: 'AppContext', ui: 'BrowserController', parent: QWidget)

Holds one canvas per space and slides between them.

SpaceStack.canvas#

canvas(space_id: str | None=None) -> Canvas | Nonesource

SpaceStack.current#

current() -> Canvas | Nonesource

Qt overrides: resizeEvent