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

jbrowser.services.downloads

Generated from the source code of JBrowser 2.0.1.

jbrowser/services/downloads.py · 455 lines

Download manager: accepts engine downloads, tracks progress, persists completed items.

Constants#

Name Value
DR QWebEngineDownloadRequest
DANGEROUS_EXTENSIONS {'.exe', '.msi', '.msix', '.msixbundle', '.appx', '.appxbundle', '.bat', '.cmd', '.com'…
HOLD_SUFFIX '.unconfirmed'
REASONS {'threat': '{host} is on a list of dangerous sites.', 'type': 'This type of file can ru…

DownloadRecord#

class DownloadRecordsource

Attributes

Name Value
url str
path str
filename str
total int = -1
received int = 0
state str = 'in_progress'
space_id str = ''
error str = ''
referrer str = ''
id str = field(default_factory=lambda: uuid.uuid4().hex[:12])
started float = field(default_factory=time.time)
finished float = 0.0
warning list = field(default_factory=list)
held bool = False
final_path str = ''

DownloadItem#

class DownloadItem(QObject)source
DownloadItem(record: DownloadRecord, request: DR | None=None, tab_id: str='', incognito: bool=False, parent: QObject | None=None)

Signals

Signal Arguments
changed (object)

DownloadItem.active#

property activesource

DownloadItem.waiting#

property waitingsource

A flagged download that needs the user's decision (keep or delete).

DownloadItem.paused#

property pausedsource

DownloadItem.fraction#

property fractionsource

DownloadItem.sample#

sample() -> Nonesource

DownloadManager#

class DownloadManager(QObject)source
DownloadManager(settings: Settings, store: Path, parent: QObject | None=None)

Signals

Signal Arguments
added (object)
updated (object)
removed (str)
activeCountChanged (int)
finished (object)
flagged (object)
blocked (object)

DownloadManager.items#

items() -> list[DownloadItem]source

DownloadManager.active_items#

active_items() -> list[DownloadItem]source

DownloadManager.overall_progress#

overall_progress() -> floatsource

DownloadManager.session_items#

session_items() -> list[DownloadItem]source

Downloads started since JBrowser opened (they keep the ribbon's Downloads button visible).

DownloadManager.waiting_items#

waiting_items() -> list[DownloadItem]source

DownloadManager.mark_seen#

mark_seen() -> Nonesource

DownloadManager.active_for_tab#

active_for_tab(tab_id: str) -> boolsource

DownloadManager.active_in_space#

active_in_space(space_id: str) -> boolsource

DownloadManager.default_directory#

default_directory() -> strsource

DownloadManager.protection#

property protectionsource

off | standard (warn and let the user keep or delete) | strict (block).

DownloadManager.assess#

assess(name: str, url: QUrl, referrer: str) -> list[str]source

Reasons to warn about a download: dangerous site, file that can run programs, no HTTPS.

DownloadManager.handle#

handle(req: DR, space_id: str, incognito: bool) -> Nonesource

DownloadManager.pause#

pause(item: DownloadItem) -> Nonesource

DownloadManager.resume#

resume(item: DownloadItem) -> Nonesource

DownloadManager.cancel#

cancel(item: DownloadItem) -> Nonesource

DownloadManager.keep#

keep(item: DownloadItem) -> Nonesource

The user trusts a flagged download: give it its real name (now, or as soon as it finishes).

DownloadManager.discard#

discard(item: DownloadItem) -> Nonesource

Delete safely: stop a flagged (or any) download and remove the file it left behind.

DownloadManager.open#

static open(item: DownloadItem) -> Nonesource

DownloadManager.show_in_folder#

static show_in_folder(item: DownloadItem) -> Nonesource

DownloadManager.remove#

remove(item: DownloadItem) -> Nonesource

DownloadManager.clear_finished#

clear_finished() -> Nonesource

DownloadManager.save_now#

save_now() -> Nonesource

Functions#

is_dangerous_file#

is_dangerous_file(name: str) -> boolsource

describe#

describe(reasons: list[str], host: str) -> strsource

One readable sentence per reason, most serious first.

write_mark_of_the_web#

write_mark_of_the_web(path: str, url: str, referrer: str, private: bool) -> boolsource

Tag a downloaded file as coming from the internet (Zone.Identifier alternate data stream), so Windows SmartScreen and Office Protected View treat it accordingly.