From 428efd02b4c914789d2cd7b3509b85f42ae64baf Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 21 Aug 2025 16:18:32 -0400 Subject: [PATCH] Add GUI extras for platform backends --- README.md | 47 ++++++++++++++++++++++++++-------------------- pyproject.toml | 5 +++++ scripts/install.sh | 13 +++++++------ 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3f6f2d9..bbbfc41 100644 --- a/README.md +++ b/README.md @@ -257,10 +257,18 @@ adding the Python GUI dependencies. 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 -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 @@ -323,31 +331,30 @@ python -m seedpass_gui seedpass-gui ``` -GUI dependencies are optional. Install them alongside SeedPass with: - -```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: +GUI dependencies are optional. Install them alongside SeedPass with the +extra for your platform: ```bash # Linux -pip install toga-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 +pip install "seedpass[gui-gtk]" # Windows -pip install toga-winforms +pip install "seedpass[gui-win]" # 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. diff --git a/pyproject.toml b/pyproject.toml index 6379d99..a94f838 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,11 @@ pillow = { version = "*", optional = true } [tool.poetry.extras] 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] pytest = "^8.2" coverage = "^7.5" diff --git a/scripts/install.sh b/scripts/install.sh index 9b50431..33b0b97 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -197,14 +197,15 @@ main() { fi fi if [ "$GUI_READY" = true ]; then - pip install -e .[gui] - print_info "Installing platform-specific Toga backend..." if [ "$OS_NAME" = "Linux" ]; then - print_info "Installing toga-gtk for Linux..." - pip install toga-gtk + print_info "Installing Linux GUI dependencies..." + pip install -e ".[gui-gtk]" elif [ "$OS_NAME" = "Darwin" ]; then - print_info "Installing toga-cocoa for macOS..." - pip install toga-cocoa + print_info "Installing macOS GUI dependencies..." + pip install -e ".[gui-mac]" + else + print_warning "Unsupported OS for GUI installation. Installing core package only." + pip install -e . fi else print_warning "Skipping GUI installation."