mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-08 07:18:47 +00:00
Document GUI backend requirement and handle missing backend
This commit is contained in:
@@ -241,6 +241,11 @@ python -m seedpass_gui
|
|||||||
seedpass-gui
|
seedpass-gui
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Install a platform-specific BeeWare backend before running these commands. Only
|
||||||
|
the headless `toga-dummy` backend is bundled for tests. Linux users should
|
||||||
|
install `toga-gtk`, Windows users need `toga-winforms`, and macOS users require
|
||||||
|
`toga-cocoa`.
|
||||||
|
|
||||||
The GUI works with the same vault and configuration files as the CLI.
|
The GUI works with the same vault and configuration files as the CLI.
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
@@ -555,6 +560,10 @@ If the checksum file is missing, generate it manually:
|
|||||||
python scripts/update_checksum.py
|
python scripts/update_checksum.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If SeedPass prints a "script checksum mismatch" warning on startup, regenerate
|
||||||
|
the checksum with `seedpass util update-checksum` or select "Generate Script
|
||||||
|
Checksum" from the Settings menu.
|
||||||
|
|
||||||
To run mutation tests locally, generate coverage data first and then execute `mutmut`:
|
To run mutation tests locally, generate coverage data first and then execute `mutmut`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@@ -116,6 +116,10 @@ Miscellaneous helper commands.
|
|||||||
| Verify script checksum | `util verify-checksum` | `seedpass util verify-checksum` |
|
| Verify script checksum | `util verify-checksum` | `seedpass util verify-checksum` |
|
||||||
| Update script checksum | `util update-checksum` | `seedpass util update-checksum` |
|
| Update script checksum | `util update-checksum` | `seedpass util update-checksum` |
|
||||||
|
|
||||||
|
If you see a startup warning about a script checksum mismatch,
|
||||||
|
run `seedpass util update-checksum` or choose "Generate Script Checksum"
|
||||||
|
from the Settings menu to update the stored value.
|
||||||
|
|
||||||
### API Commands
|
### API Commands
|
||||||
|
|
||||||
Run or stop the local HTTP API.
|
Run or stop the local HTTP API.
|
||||||
|
@@ -14,6 +14,11 @@ python -m seedpass_gui
|
|||||||
seedpass-gui
|
seedpass-gui
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Install a platform-specific BeeWare backend before launching the GUI. The
|
||||||
|
distribution only bundles the headless `toga-dummy` backend for automated
|
||||||
|
tests. Linux users should install `toga-gtk`, Windows users need
|
||||||
|
`toga-winforms`, and macOS users require `toga-cocoa`.
|
||||||
|
|
||||||
The GUI shares the same encrypted vault and configuration as the command line tool.
|
The GUI shares the same encrypted vault and configuration as the command line tool.
|
||||||
|
|
||||||
To generate a packaged binary, run `briefcase build` (after the initial `briefcase create`).
|
To generate a packaged binary, run `briefcase build` (after the initial `briefcase create`).
|
||||||
|
@@ -497,6 +497,10 @@ If the checksum file is missing, generate it manually:
|
|||||||
python scripts/update_checksum.py
|
python scripts/update_checksum.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If SeedPass reports a "script checksum mismatch" warning on startup,
|
||||||
|
regenerate the checksum with `seedpass util update-checksum` or select
|
||||||
|
"Generate Script Checksum" from the Settings menu.
|
||||||
|
|
||||||
To run mutation tests locally, generate coverage data first and then execute `mutmut`:
|
To run mutation tests locally, generate coverage data first and then execute `mutmut`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@@ -24,6 +24,7 @@ import uvicorn
|
|||||||
from . import api as api_module
|
from . import api as api_module
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
|
import importlib.util
|
||||||
|
|
||||||
app = typer.Typer(
|
app = typer.Typer(
|
||||||
help="SeedPass command line interface",
|
help="SeedPass command line interface",
|
||||||
@@ -95,6 +96,14 @@ def _get_nostr_service(ctx: typer.Context) -> NostrService:
|
|||||||
return NostrService(pm)
|
return NostrService(pm)
|
||||||
|
|
||||||
|
|
||||||
|
def _gui_backend_available() -> bool:
|
||||||
|
"""Return True if a platform-specific BeeWare backend is installed."""
|
||||||
|
for pkg in ("toga_gtk", "toga_winforms", "toga_cocoa"):
|
||||||
|
if importlib.util.find_spec(pkg) is not None:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@app.callback(invoke_without_command=True)
|
@app.callback(invoke_without_command=True)
|
||||||
def main(ctx: typer.Context, fingerprint: Optional[str] = fingerprint_option) -> None:
|
def main(ctx: typer.Context, fingerprint: Optional[str] = fingerprint_option) -> None:
|
||||||
"""SeedPass CLI entry point.
|
"""SeedPass CLI entry point.
|
||||||
@@ -740,6 +749,14 @@ def api_stop(ctx: typer.Context, host: str = "127.0.0.1", port: int = 8000) -> N
|
|||||||
@app.command()
|
@app.command()
|
||||||
def gui() -> None:
|
def gui() -> None:
|
||||||
"""Launch the BeeWare GUI."""
|
"""Launch the BeeWare GUI."""
|
||||||
|
if not _gui_backend_available():
|
||||||
|
typer.echo(
|
||||||
|
"No BeeWare GUI backend found. Install 'toga-gtk' (Linux), "
|
||||||
|
"'toga-winforms' (Windows) or 'toga-cocoa' (macOS) to run the GUI.",
|
||||||
|
err=True,
|
||||||
|
)
|
||||||
|
raise typer.Exit(1)
|
||||||
|
|
||||||
from seedpass_gui.app import main
|
from seedpass_gui.app import main
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@@ -557,6 +557,14 @@ def test_gui_command(monkeypatch):
|
|||||||
"seedpass_gui.app",
|
"seedpass_gui.app",
|
||||||
SimpleNamespace(main=fake_main),
|
SimpleNamespace(main=fake_main),
|
||||||
)
|
)
|
||||||
|
monkeypatch.setattr(cli.importlib.util, "find_spec", lambda n: True)
|
||||||
result = runner.invoke(app, ["gui"])
|
result = runner.invoke(app, ["gui"])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert called.get("called") is True
|
assert called.get("called") is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_gui_command_no_backend(monkeypatch):
|
||||||
|
monkeypatch.setattr(cli.importlib.util, "find_spec", lambda n: None)
|
||||||
|
result = runner.invoke(app, ["gui"])
|
||||||
|
assert result.exit_code == 1
|
||||||
|
assert "BeeWare GUI backend" in result.stderr
|
||||||
|
Reference in New Issue
Block a user