Commit graph

10 commits

Author SHA1 Message Date
GaltRanch
cb89d6fbcf Restore Panel boxes with transparent background (style='on default')
Bring back the Panel borders for sysinfo, status bar, header, and menu
but use style='on default' which inherits the terminal's background
color instead of Rich's default dark gray. border_style='dim' keeps
the borders subtle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:29:47 -03:00
GaltRanch
db640ac8fc Replace Rich Tables with inline console.print for transparent backgrounds
Tables pad columns with spaces that show a different background color.
Switch sysinfo and menu to console.print() with markup strings instead,
which render with the terminal's native background color.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:28:30 -03:00
GaltRanch
2f60500162 Remove Rich Panel borders from status bar and header
Replace Panel() wrappers with plain text output for status_bar and
header — Panels create a visible background box that clashes with
dark terminal themes. Error/warning panels kept as-is since they
should visually stand out.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:26:29 -03:00
GaltRanch
b86fdcb1ce Fix Rich background colors to match terminal background
- Use transparent backgrounds instead of forced dark grays in panels
- Replace ░ block chars with ─ dashes for progress bar empty space
- Set console highlight=False to prevent unwanted auto-styling
- Remove pyblock.dim style from panels (used default dim instead)

Rich elements now blend seamlessly with the terminal's own background.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:24:28 -03:00
GaltRanch
88b1609100 Fix Rich sysinfo bar rendering raw markup tags
Use Text.from_markup() instead of Text() for the CPU/Memory progress
bars so Rich markup tags ([green], [dim]) are interpreted as styles
rather than displayed as literal text.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:46:35 -03:00
GaltRanch
3df92e3ef7 Upgrade show_error/warning/success to use Rich panels when available
Error messages now render as styled Rich panels with colored borders:
- Errors: red border panel with "Error" title
- Warnings: yellow border panel with "Warning" title
- Success: green checkmark prefix
Falls back to ANSI output if Rich is not importable.

This affects all 217+ error display points across both PyBlock.py and
SPV/spvblock.py automatically since they all call show_error().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:30:21 -03:00
GaltRanch
40a931a25f Upgrade sysinfo() to Rich with color-coded CPU/Memory bars
Replace ANSI-coded system info with Rich table showing:
- CPU: color bar (green/yellow/red based on load) + percentage
- Memory: color bar + percentage
Falls back to original ANSI output if Rich is not available.

This change affects every screen in the app since sysinfo() is called
on most menu renders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:28:02 -03:00
GaltRanch
db35505284 Add shared/rich_ui.py with Rich-based UI components
Level 2 foundation module providing styled alternatives to ANSI output:
- rich_status_bar(): Panel with mode/block/price using PyBLOCK theme
- rich_sysinfo(): CPU/Memory with color-coded progress bars
- rich_menu(): Table-based menu rendering with styled keys
- rich_header(): Node info panel with alias/block/version
- rich_error/warning/success(): Styled message panels
- rich_loading(): Rich Progress spinner for async operations
- rich_prompt(): Styled input prompt
- PYBLOCK_THEME: Custom Rich theme with bitcoin color scheme

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:27:25 -03:00
GaltRanch
915da7a1d5 Add shared/ui.py with status bar, spinner, error display, and input validation
Foundation module for Level 1 frontend improvements:
- status_bar(): persistent header showing mode, block height, BTC price
- show_error/warning/success(): visible user-facing messages
- Spinner: context manager for loading animations on API calls
- prompt_menu(): input validation with back-button support
- ANSI color constants for consistent styling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:06:17 -03:00
GaltRanch
7366e9fe9c Refactor architecture: config singleton, logging, menu system, dependencies
Major improvements across 7 areas:

- Add centralized Config singleton (config.py) replacing ~176 config
  reloads per session with a single cached load
- Add logging framework (log.py) with RotatingFileHandler, replacing
  silent except Exception: pass blocks with structured logging
- Refactor menu system (menu.py) with data-driven color selection,
  eliminating ~1,370 lines of duplicate menu functions
- Create shared/ modules extracting 7 utility functions duplicated
  between PyBlock.py and SPV/spvblock.py
- Clean dependencies: pin all versions, remove stdlib packages
  (asyncio, threading), remove unused imports
- Improve Docker: pin ubuntu:24.04, add non-root user, use venv
- Improve CI: update to actions v4/v5, add test job before publish
- Fix entry point: wrap main loop in def main(), proper module import

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 10:58:24 -03:00