Phase 6: GUI refactor — extract pt_hub.py into modular hub package#5
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pt_hub.pymonolith into 13 focused modules undersrc/powertrader/hub/app.py)pt_hub.pypreserved as backward-compatible entry point;scripts/run_hub.pynow delegates to the new modular packageModule Breakdown
theme.pyutils.pycomponents/process_manager.pydialogs/settings_dialog.pyapp.pyTest Plan
from powertrader.hub.app import PowerTraderHub)pt_hub.pystill importable (backward compatible)scripts/run_hub.pyentry point updated and working🤖 Generated with Claude Code