JBrowser Source Docs

jbrowser.ui.widgets

Generated from the source code of JBrowser 1.5.4.

jbrowser/ui/widgets.py · 723 lines

Reusable, custom-painted widgets that follow the theme and the global motion policy.

IconButton#

class IconButton(QAbstractButton)source
IconButton(glyph_name: str, tooltip: str='', parent: QWidget | None=None, size: int=32, glyph_px: float | None=None, checkable: bool=False, variant: str='normal', width: int | None=None)

Flat, rounded icon button with hover/pressed states, optional badge and progress ring.

IconButton.set_glyph#

set_glyph(name: str) -> Nonesource

IconButton.set_badge#

set_badge(text: str | None, token: str='accent') -> Nonesource

IconButton.set_progress#

set_progress(value: float | None) -> Nonesource

IconButton.set_active_color#

set_active_color(token: str | None) -> Nonesource

IconButton.set_force_hover#

set_force_hover(v: bool) -> Nonesource

IconButton.set_force_pressed#

set_force_pressed(v: bool) -> Nonesource

Qt overrides: enterEvent, leaveEvent, sizeHint, paintEvent

ToggleSwitch#

class ToggleSwitch(QAbstractButton)source
ToggleSwitch(checked: bool=False, parent: QWidget | None=None)

Windows 11 style toggle switch with an animated knob.

Qt overrides: enterEvent, leaveEvent, paintEvent

Spinner#

class Spinner(QWidget)source
Spinner(size: int=16, parent: QWidget | None=None)

Indeterminate progress arc. Only animates while visible.

Qt overrides: showEvent, hideEvent, paintEvent

ProgressLine#

class ProgressLine(QWidget)source
ProgressLine(parent: QWidget | None=None)

Thin loading bar that eases towards the target value.

ProgressLine.set_progress#

set_progress(value: int, loading: bool) -> Nonesource

Qt overrides: paintEvent

ElidedLabel#

class ElidedLabel(QLabel)source
ElidedLabel(text: str='', parent: QWidget | None=None, mode=Qt.TextElideMode.ElideRight)

Qt overrides: paintEvent

InfoBarWidget#

class InfoBarWidget(QFrame)source
InfoBarWidget(spec: InfoBarSpec, parent: QWidget | None=None)

Renders an InfoBarSpec inside a card (permission prompts, save password, ...).

Signals

Signal Arguments
closed (str)

InfoBarWidget.dismiss#

dismiss() -> Nonesource

Qt overrides: paintEvent

Toast#

class Toast(QWidget)source
Toast(text: str, glyph_name: str, parent: QWidget)

Qt overrides: paintEvent

ToastManager#

class ToastManager(QObject)source
ToastManager(host: QWidget)

Stacks transient notifications at the bottom-centre of a host widget.

ToastManager.show#

show(text: str, glyph_name: str='info', duration_ms: int=2600) -> Nonesource

Qt overrides: eventFilter

Overlay#

class Overlay(QWidget)source
Overlay(host: QWidget)

Base class for full-window modal overlays (Lazy Toolbar, cheat sheet) with a scrim.

Signals

Signal Arguments
closed ()

Overlay.panel_rect#

panel_rect() -> QRectsource

Overlay.open_overlay#

open_overlay() -> Nonesource

Overlay.close_overlay#

close_overlay() -> Nonesource

Qt overrides: eventFilter, paintEvent, mousePressEvent, keyPressEvent

TintPicker#

class TintPicker(QWidget)source
TintPicker(value: str='none', parent: QWidget | None=None, swatch: int=26, gap: int=8)

A row of colour swatches: "No colour" plus the tints in theme.TINTS.

Click a swatch, or use Tab / arrow keys and Space / Enter. Every swatch has its name as a tooltip and accessible description, and the selected one gets a ring and a tick.

Signals

Signal Arguments
changed (str)

TintPicker.value#

value() -> strsource

TintPicker.set_value#

set_value(key: str, emit: bool=False) -> Nonesource

TintPicker.label#

static label(key: str) -> strsource

Qt overrides: mouseMoveEvent, leaveEvent, mousePressEvent, keyPressEvent, focusInEvent, focusOutEvent, paintEvent

Functions#

hline#

hline(parent: QWidget | None=None) -> QFramesource

muted_label#

muted_label(text: str, parent: QWidget | None=None, wrap: bool=True) -> QLabelsource

vbox#

vbox(*widgets, margins=(0, 0, 0, 0), spacing=8) -> QVBoxLayoutsource

hbox#

hbox(*widgets, margins=(0, 0, 0, 0), spacing=8) -> QHBoxLayoutsource

rounded_rect_path#

rounded_rect_path(r: QRectF, radius: float) -> QPainterPathsource

point_in#

point_in(widget: QWidget, global_pos: QPoint) -> boolsource
menu_action(menu, text: str, callback=None, glyph: str | None=None, *, checkable: bool=False, checked: bool=False, shortcut: str | None=None, enabled: bool=True)source

Add an action to a QMenu with an optional Fluent glyph and callback.

submenu(menu, text: str, glyph: str | None=None)source