jbrowser.ui.canvas
Generated from the source code of JBrowser 2.0.0.
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 |
DRAG_LIFT |
6 |
SLOT |
'__slot__' |
SMOOTH_TAU |
0.055 |
SHADOW_LAYERS |
{False: ((9, 0.1), (5, 0.16), (2, 0.24)), True: ((22, 0.1), (13, 0.18), (6, 0.26))} |
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, float, float]]source
Card id → (x, width, top, height). Cards stacked in a column share x and width and split its height; while the stack picker or a stacking drop is pending, SLOT is the empty place.
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
A card's x and width in px (its column's).
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
Wheel / touchpad scrolling. animated eases (mouse wheel notches); otherwise the canvas
follows exactly (touchpad), but still moves at most once per frame.
Canvas.ensure_visible#
ensure_visible(tab_id: str, align: str='nearest', animated: bool=True) -> Nonesource
Canvas.horizontal_delta#
static horizontal_delta(e) -> tuple[float, bool]source
The sideways part of a wheel event and whether it came from a touchpad (pixel deltas). Only scrolling that is mostly sideways counts, or the wheel with Shift held (Windows' usual horizontal scroll); up-and-down scrolling gives 0.
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
Canvas.open_stack_picker#
open_stack_picker(tab_id: str) -> boolsource
Open the empty place below a card, with what can be stacked there (ui/stack_picker.py).
Canvas.close_stack_picker#
close_stack_picker(animated: bool=True) -> Nonesource
Canvas.finish_stack_picker#
finish_stack_picker(action) -> Nonesource
The picker's choice: the slot closes and action puts the chosen card there, growing out of
the slot's place.
Canvas.cancel_drag#
cancel_drag() -> Nonesource
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