Commit graph

5 commits

Author SHA1 Message Date
GaltRanch
86aff5bad2 Fix TUI widget lifecycle: use single Static view for content swapping
Replace mount/remove_children pattern (async issues, duplicate IDs)
with a single persistent #section-view Static widget that gets its
content updated via .update(). All sections now render correctly:

- Dashboard: summary table + latest blocks (fetched async from API)
- Bitcoin/Lightning/Platforms/Settings: info panels
- M key: return to main menu

Also added fetch_latest_blocks() and fetch_hashrate() data workers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:15:44 -03:00
GaltRanch
6eecc5750a Wire up TUI menu actions with live data panels
Each menu key now loads real content:
- A (Dashboard): block height, price, hashrate, difficulty, mempool
  stats, and latest 5 blocks table — all from mempool.space API
- B (Bitcoin): submenu with blockchain features
- L (Lightning): channel management overview
- P (Platforms): API integrations list
- S (Settings): current mode and config info
- M: return to main menu from any section

New data fetchers: fetch_latest_blocks(), fetch_hashrate(),
fetch_mempool_info() expanded.

Dashboard loads async via run_worker(thread=True) with live
content replacement in the center panel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:12:36 -03:00
GaltRanch
8440b7b83b Fix TUI main menu: convert Screen to Widget for proper rendering
MainMenuScreen was a Textual Screen mounted inside a Vertical container,
which doesn't render. Create MainMenu as a Static widget instead:
- New tui/widgets/main_menu.py with Panel+Table menu
- Move keybindings (A/B/L/P/S/Q) to the App level
- Menu now renders correctly in the content area

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:09:32 -03:00
GaltRanch
92b461662c Fix Textual TUI async worker to use run_worker(thread=True)
Replace run_in_thread (not available in Textual 0.89) with
run_worker(fn, thread=True) + call_from_thread for UI updates.
The TUI now launches correctly and fetches live data (block height,
BTC price, fee estimates) on startup and every 30 seconds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:44:02 -03:00
GaltRanch
b6540b059b Add Textual TUI dashboard (Level 3) with --tui launch flag
New pybitblock/tui/ package providing a modern terminal UI:

Structure:
  tui/app.py           - Main Textual App with CSS layout, auto-refresh
  tui/screens/         - Screen classes (main_menu.py with keybindings)
  tui/widgets/         - StatusBar widget with reactive block/price data
  tui/workers/         - Async data fetchers (block height, price, fees, mempool)

Features:
  - Persistent status bar with mode, block height, BTC price
  - Side panel showing live fee estimates (fast/medium/slow)
  - Keyboard navigation (A=PyBLOCK, B=Bitcoin, L=Lightning, etc.)
  - Auto-refresh every 30 seconds via async workers
  - Dark theme with Bitcoin-inspired color scheme
  - CSS-based responsive layout

Launch: python3 PyBlock.py --tui
Fallback: python3 PyBlock.py (original CLI mode)

Added textual>=0.89 to requirements.txt.

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