Skip to content

Phase 6: GUI refactor — extract pt_hub.py into modular hub package#5

Merged
Ibrahim-3d merged 3 commits into
mainfrom
claude/phase-6-gui-refactor
Feb 11, 2026
Merged

Phase 6: GUI refactor — extract pt_hub.py into modular hub package#5
Ibrahim-3d merged 3 commits into
mainfrom
claude/phase-6-gui-refactor

Conversation

@Ibrahim-3d
Copy link
Copy Markdown
Owner

Summary

  • Breaks the 5,236-line pt_hub.py monolith into 13 focused modules under src/powertrader/hub/
  • Extracts theme constants, utilities, widget components (WrapFrame, NeuralSignalTile, CandleFetcher, CandleChart, AccountValueChart), ProcessManager, SettingsDialog, and a slim orchestrator (app.py)
  • Original pt_hub.py preserved as backward-compatible entry point; scripts/run_hub.py now delegates to the new modular package

Module Breakdown

Module Lines Purpose
theme.py 15 Dark theme color constants
utils.py 219 Shared utilities, DEFAULT_SETTINGS, formatting
components/ 5 files, ~1,082 WrapFrame, NeuralSignalTile, CandleFetcher, CandleChart, AccountValueChart
process_manager.py 427 Subprocess lifecycle (decoupled from Tk via callbacks)
dialogs/settings_dialog.py 654 Settings dialog + Binance API wizard
app.py 1,903 Orchestrator importing all extracted modules

Test Plan

  • All 528 existing tests pass
  • All module imports verified (from powertrader.hub.app import PowerTraderHub)
  • Original pt_hub.py still importable (backward compatible)
  • scripts/run_hub.py entry point updated and working
  • Manual GUI smoke test (launch, verify layout identical)

🤖 Generated with Claude Code

Ibrahim-3d and others added 3 commits February 10, 2026 18:13
…ub package

Break the 5,236-line pt_hub.py into focused modules under src/powertrader/hub/:

- theme.py (15 lines): Dark theme color constants
- utils.py (219 lines): Shared utilities, DEFAULT_SETTINGS, formatting helpers
- components/wrap_frame.py: CSS flex-wrap equivalent for Tkinter
- components/signal_tile.py: Neural signal level visualization widget
- components/candle_fetcher.py: KuCoin market data with cache
- components/candle_chart.py: Candlestick chart with neural overlays
- components/account_chart.py: Account value line graph with trade markers
- process_manager.py (427 lines): Subprocess lifecycle management (decoupled from Tk)
- dialogs/settings_dialog.py (654 lines): Settings dialog with Binance API wizard
- app.py (1,903 lines): Slim orchestrator importing all extracted modules

Original pt_hub.py preserved as backward-compatible entry point.
All 528 tests pass. GUI looks and works identically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set self.project_dir before _load_settings() which depends on it.
Without this, launching via the new module path raises AttributeError.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Ibrahim-3d Ibrahim-3d merged commit 0340efd into main Feb 11, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant