Add GUI extras for platform backends

This commit is contained in:
thePR0M3TH3AN
2025-08-21 16:18:32 -04:00
parent cfb861b60a
commit 428efd02b4
3 changed files with 39 additions and 26 deletions

View File

@@ -257,10 +257,18 @@ adding the Python GUI dependencies.
brew install pygobject3 gtk+3 adwaita-icon-theme librsvg webkitgtk brew install pygobject3 gtk+3 adwaita-icon-theme librsvg webkitgtk
``` ```
With the system requirements in place, install the Python GUI extras: With the system requirements in place, install the Python GUI extras for your
platform:
```bash ```bash
pip install .[gui] # Linux
pip install .[gui-gtk]
# Windows
pip install .[gui-win]
# macOS
pip install .[gui-mac]
``` ```
CLI-only users can skip these steps and install just the core package for a CLI-only users can skip these steps and install just the core package for a
@@ -323,31 +331,30 @@ python -m seedpass_gui
seedpass-gui seedpass-gui
``` ```
GUI dependencies are optional. Install them alongside SeedPass with: GUI dependencies are optional. Install them alongside SeedPass with the
extra for your platform:
```bash
pip install "seedpass[gui]"
# or when working from a local checkout
pip install -e .[gui]
```
After installing the optional GUI extras, add the BeeWare backend for your
platform:
```bash ```bash
# Linux # Linux
pip install toga-gtk pip install "seedpass[gui-gtk]"
# If you see build errors about "cairo" on Linux, install the cairo
# development headers using your package manager, e.g.:
sudo apt-get install libcairo2 libcairo2-dev
# Windows # Windows
pip install toga-winforms pip install "seedpass[gui-win]"
# macOS # macOS
pip install toga-cocoa pip install "seedpass[gui-mac]"
# or when working from a local checkout
pip install -e ".[gui-gtk]" # Linux
pip install -e ".[gui-win]" # Windows
pip install -e ".[gui-mac]" # macOS
```
If you see build errors about "cairo" on Linux, install the cairo development
headers using your package manager, e.g.:
```bash
sudo apt-get install libcairo2 libcairo2-dev
``` ```
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.

View File

@@ -40,6 +40,11 @@ pillow = { version = "*", optional = true }
[tool.poetry.extras] [tool.poetry.extras]
gui = ["toga-core", "pillow"] gui = ["toga-core", "pillow"]
[project.optional-dependencies]
gui-gtk = ["toga-gtk>=0.5.2"]
gui-win = ["toga-winforms>=0.5.2"]
gui-mac = ["toga-cocoa>=0.5.2"]
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pytest = "^8.2" pytest = "^8.2"
coverage = "^7.5" coverage = "^7.5"

View File

@@ -197,14 +197,15 @@ main() {
fi fi
fi fi
if [ "$GUI_READY" = true ]; then if [ "$GUI_READY" = true ]; then
pip install -e .[gui]
print_info "Installing platform-specific Toga backend..."
if [ "$OS_NAME" = "Linux" ]; then if [ "$OS_NAME" = "Linux" ]; then
print_info "Installing toga-gtk for Linux..." print_info "Installing Linux GUI dependencies..."
pip install toga-gtk pip install -e ".[gui-gtk]"
elif [ "$OS_NAME" = "Darwin" ]; then elif [ "$OS_NAME" = "Darwin" ]; then
print_info "Installing toga-cocoa for macOS..." print_info "Installing macOS GUI dependencies..."
pip install toga-cocoa pip install -e ".[gui-mac]"
else
print_warning "Unsupported OS for GUI installation. Installing core package only."
pip install -e .
fi fi
else else
print_warning "Skipping GUI installation." print_warning "Skipping GUI installation."