adsfolio.gui.updates

Check GitHub for stable desktop releases without blocking the window.

class adsfolio.gui.updates.InstallationKind(*values)[source]

Bases: enum.Enum

How this copy of ADSfolio was installed, which decides how to update.

DESKTOP = 'Desktop application'
HOMEBREW = 'Homebrew application'
PYTHON = 'Python installation'
SOURCE = 'Local source launcher'
class adsfolio.gui.updates.Release(version, url, tag='', assets=())[source]

Bases: object

A stable release, its download page, and its published asset names.

Parameters:
assets: tuple[str, ...] = ()
download_url(name)[source]

Return the project download URL for one asset of this release.

Parameters:

name (str)

Return type:

str

tag: str = ''
url: str
version: packaging.version.Version
class adsfolio.gui.updates.UpdateChecker(parent=None)[source]

Bases: PySide6.QtCore.QObject

Keep one asynchronous release check and its latest result.

Parameters:

parent (QObject | None)

property busy: bool[source]

Return whether a request is still active.

cancel()[source]

Abort an active check and discard its pending result.

Return type:

None

changed
changelog: str | None
property changelog_busy: bool[source]

Return whether the release notes are still loading.

changelog_error: str | None
check()[source]

Start a public GitHub lookup unless one is already running.

Return type:

None

checked_at: datetime.datetime | None
error: str | None
fetch_changelog()[source]

Load the notes between this version and the available release.

The notes come from CHANGELOG.md at the release tag, because the GitHub release body contains only generated comparison links.

Return type:

None

finished
latest: adsfolio.gui.updates.Release | None
staticMetaObject = PySide6.QtCore.QMetaObject("UpdateChecker" inherits "QObject": Methods:   #4 type=Signal, signature=changed()   #5 type=Signal, signature=finished()   #6 type=Slot, signature=check()   #7 type=Slot, signature=_complete_changelog()   #8 type=Slot, signature=_complete() )
property status: str[source]

Describe the current check for the About window.

property update_available: bool[source]

Return whether the checked release is newer than this installation.

class adsfolio.gui.updates.UpdateDownloader(parent=None)[source]

Bases: PySide6.QtCore.QObject

Download one release asset and verify it against the release checksums.

The checksum file is fetched first. The asset streams to <name>.part while it is hashed, and it is renamed only after the SHA-256 digest matches. The checksums come from the same release, so the check detects corrupted or truncated downloads; it does not authenticate the publisher.

Parameters:

parent (QObject | None)

property busy: bool[source]

Return whether a checksum or asset request is active.

cancel()[source]

Abort the download and remove its partial file.

Return type:

None

changed
completed
error: str | None
path: pathlib.Path | None
progress
property release: adsfolio.gui.updates.Release | None[source]

Return the release of the current or last download.

start(release, name, directory)[source]

Download asset name of release into directory.

Parameters:
Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("UpdateDownloader" inherits "QObject": Methods:   #4 type=Signal, signature=changed()   #5 type=Signal, signature=progress(PyObject,PyObject), parameters=PyObject, PyObject   #6 type=Signal, signature=completed(PyObject), parameters=PyObject   #7 type=Slot, signature=_checksums_done()   #8 type=Slot, signature=_forward_progress(qlonglong,qlonglong), parameters=qlonglong, qlonglong   #9 type=Slot, signature=_write_available()   #10 type=Slot, signature=_asset_done() )
adsfolio.gui.updates.asset_name(platform, machine)[source]

Return the release asset that installs on a platform, or None.

Parameters:
  • platform (str) – A sys.platform value.

  • machine (str) – A platform.machine() value of the running process.

Return type:

str | None

adsfolio.gui.updates.changelog_between(markdown, current, latest)[source]

Return changelog sections newer than current up to latest.

Sections start at ## <version> headings. Sections whose heading does not begin with a version, such as ## Unreleased, are skipped.

Parameters:
Return type:

str

adsfolio.gui.updates.download_filename(release, name)[source]

Insert the release version into an unversioned asset file name.

Parameters:
Return type:

str

adsfolio.gui.updates.installation_kind(environ=None, *, frozen=None, platform=None, caskrooms=None)[source]

Classify the running installation.

The source launcher is checked first: a machine can have both a Homebrew cask record and a source launcher that replaced the cask’s application.

Parameters:
Return type:

adsfolio.gui.updates.InstallationKind

adsfolio.gui.updates.parse_release(payload)[source]

Read a stable release from a GitHub API response.

Raises:
  • TypeError – If the response is not a JSON object.

  • ValueError – If the response does not describe a published stable version.

Parameters:

payload (object)

Return type:

adsfolio.gui.updates.Release

adsfolio.gui.updates.parse_sha256sums(text)[source]

Map file names to lowercase SHA-256 digests from sha256sum output.

Parameters:

text (str)

Return type:

dict[str, str]