Files
bal-electrum-plugin/bal/__init__.py
bitcoinafterlife 4b0af6f4bf v0.6.1: read version from manifest.json (single source of truth)
Read the plugin version at runtime from bal/manifest.json via
importlib.resources (zip-safe, works from inside a zip on Windows).
Removes the four-file duplication (VERSION, __init__.py, plugin_base.py,
manifest.json) and deletes the bal/VERSION file.

- bal/core/plugin_base.py: new get_version() function, BalPlugin.version
  is now a @property, removed hardcoded __version__
- bal/__init__.py: removed __version__, replaced with a comment
- bal/core/willexecutors.py: user-agent uses get_version()
- bal/gui/qt/dialogs.py, widgets.py: call sites use .version property
- tests/test_version_source.py: 7 tests incl. zip-safe subprocess check
- HANDOFF.md: updated to single-source-of-truth documentation
- CHANGELOG.md: entries 43-46
- bal/manifest.json: version bumped to 0.6.1

PR #4 (branch bitcoinafterlife-patch-5).
2026-07-22 11:19:18 -04:00

43 lines
2.2 KiB
Python

"""BAL - Bitcoin After Life Electrum plugin.
Free and decentralized Bitcoin inheritance support for the Electrum wallet.
This package was reorganized (Approach A: conservative, behavior-preserving)
to cleanly separate logic from presentation. The original monolithic plugin
mixed the business logic with the PyQt GUI; here the two concerns live in
distinct sub-packages:
bal/
core/ GUI-free business logic (importable without Qt)
util.py Generic helpers (encoding, validation, ...)
plugin_base.py BasePlugin subclass, config, timestamp handling
heirs.py Heir list model + transaction building
will.py Will / WillItem domain model
willexecutors.py Will-executor (dead-man's switch) networking
gui/
qt/ PyQt6 presentation layer
theme.py Colors / status -> color mapping (status_color)
common.py Shared imports and small GUI helpers
widgets.py Leaf widgets (editors, labels, checkboxes, ...)
calendar.py BalCalendar widget
dialogs.py Dialog windows (wizard, build-will, detail, ...)
lists.py Tree/list views (heirs, preview, will-executors)
window.py BalWindow controller (per-wallet GUI state)
plugin.py Plugin class wiring Electrum @hooks to the GUI
qt.py Thin loader shim re-exporting `Plugin` for Electrum
Electrum discovers the plugin through ``manifest.json`` and loads the GUI
entry point from ``qt.py`` (the shim), which imports the real ``Plugin``
from ``gui.qt.plugin``.
The plugin supports Electrum 4.7.2 and 4.8.0 with PyQt6. Electrum 4.8.0 removed
``json_db.register_dict`` and replaced it with the path-based
``electrum.stored_dict.register_name``; ``core.plugin_base`` detects which API is
available and adapts, so both releases keep working.
"""
# The plugin version is NOT defined here. It lives only in ``bal/manifest.json``
# (the single source of truth) and is read at runtime via ``get_version()`` in
# ``bal/core/plugin_base.py`` (exposed as the ``BalPlugin.version`` property).
# Keeping a hardcoded ``__version__`` here would just be a stale duplicate.