Split the monolith gui.py into a focused package#84
Merged
Conversation
The single mkpfs/gui.py file had grown to 1843 lines mixing translations, theme, widgets, and six distinct operation panels. This refactor splits it into a gui/ package with clear separation of concerns: - gui/i18n.py — translations and locale state - gui/theme.py — palette, fonts, and panel accent color - gui/widgets.py — reusable UI components - gui/panels/ — one module per operation (pack_folder, pack_file, verify, inspect, tree, unpack) plus a shared base class - gui/app.py — MkPFSApp and main() entry point - gui/__init__.py — re-exports main() for the mkpfs-gui entry point No user-facing changes. The old gui.py is deleted.
Code Coverage OverviewLanguages: Python Python / code-coverage/pytestThe overall coverage in the branch is 74%. The coverage in the branch is 75%. Show a code coverage summary of the most impacted files.
Updated |
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors GUI from monolithic mkpfs/gui.py into structured mkpfs/gui/ package, separating i18n, theme, widgets, and per-operation panels to make GUI code easier to navigate and maintain while keeping mkpfs-gui entrypoint working.
Changes:
- Split GUI into
mkpfs/gui/package (theme + i18n + widgets + app + panels + base panel). - Moved each operation into its own panel module under
mkpfs/gui/panels/; deleted oldmkpfs/gui.py. - Repo housekeeping: add pi-task artifacts/ignores and tweak ignore/docs files.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mkpfs/gui/widgets.py | New reusable widget layer (cards, rows, buttons, log pane, nav button). |
| mkpfs/gui/theme.py | Centralized GUI palette/fonts + per-panel accent map. |
| mkpfs/gui/i18n.py | Centralized translations, locale state, and tr() helper. |
| mkpfs/gui/app.py | Main MkPFSApp window + sidebar/nav + main() entrypoint. |
| mkpfs/gui/init.py | Re-export main() to preserve CLI entrypoint behavior. |
| mkpfs/gui/panels/base.py | Shared BasePanel with logging, threading, and in-process CLI runner. |
| mkpfs/gui/panels/pack_folder.py | Pack-folder panel extracted to its own module. |
| mkpfs/gui/panels/pack_file.py | Pack-file panel extracted to its own module. |
| mkpfs/gui/panels/verify.py | Verify panel extracted to its own module. |
| mkpfs/gui/panels/inspect.py | Inspect panel extracted to its own module. |
| mkpfs/gui/panels/tree.py | Tree panel extracted to its own module. |
| mkpfs/gui/panels/unpack.py | Unpack panel extracted to its own module. |
| mkpfs/gui/panels/init.py | Panel package exports for app wiring. |
| mkpfs/gui.py | Deleted old monolithic GUI module. |
| AGENTS.md | Add “token efficiency” guidance for agents. |
| .pi-tasks/TASK_AUTO_0001.md | Add tracked task record describing refactor plan/decisions. |
| .pi-tasks/.ignore | Add ripgrep/fd ignore rules for .pi-tasks/. |
| .graphifyignore | Add graphify ignore rules. |
| .gitignore | Add/update ignore patterns (including .pi-tasks/). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The old monolithic mkpfs/gui.py was deleted during the GUI refactor. PyInstaller entry points now point to mkpfs/gui/__init__.py which re-exports main() from the new gui/app.py module.
- Remove unused _BG_*, _TEXT_*, _SUCCESS constants from theme.py - Remove unused _LANG_NAMES from i18n.py - Fix pip install suggestion to use uv sync --group dev - Consolidate duplicate Entry point header in app.py
The automated review flagged theme.py constants and _LANG_NAMES as unused because CodeQL analyzed each source file in isolation. Every constant is actively imported and used across gui/ submodules. Also keep two genuine review fixes: - Remove duplicate kwargs.setdefault in widgets.py - Remove redundant export_btn.configure in base.py - Fix uv hint to say 'uv sync' (cryptography is a project dep)
| }, | ||
| } | ||
|
|
||
| _LANG_NAMES: dict[str, str] = { |
| """Neon glassmorphism theme constants for the mkpfs GUI.""" | ||
|
|
||
| # Backgrounds — deep space | ||
| _BG_DEEP = "#0B0E17" # deepest background |
|
|
||
| # Backgrounds — deep space | ||
| _BG_DEEP = "#0B0E17" # deepest background | ||
| _BG_PANEL = "#121626" # card / panel body |
| # Backgrounds — deep space | ||
| _BG_DEEP = "#0B0E17" # deepest background | ||
| _BG_PANEL = "#121626" # card / panel body | ||
| _BG_CARD = "#181E2D" # inner card |
| _BG_DEEP = "#0B0E17" # deepest background | ||
| _BG_PANEL = "#121626" # card / panel body | ||
| _BG_CARD = "#181E2D" # inner card | ||
| _BG_INPUT = "#1A2035" # text input / textbox bg |
| _BG_PANEL = "#121626" # card / panel body | ||
| _BG_CARD = "#181E2D" # inner card | ||
| _BG_INPUT = "#1A2035" # text input / textbox bg | ||
| _BORDER_BRIGHT = "#2B3553" # bright border accent |
| _BG_CARD = "#181E2D" # inner card | ||
| _BG_INPUT = "#1A2035" # text input / textbox bg | ||
| _BORDER_BRIGHT = "#2B3553" # bright border accent | ||
| _TEXT_PRIMARY = "#E8EDF5" # primary text |
| _BG_INPUT = "#1A2035" # text input / textbox bg | ||
| _BORDER_BRIGHT = "#2B3553" # bright border accent | ||
| _TEXT_PRIMARY = "#E8EDF5" # primary text | ||
| _TEXT_SECONDARY = "#8892B0" # secondary text |
| _BORDER_BRIGHT = "#2B3553" # bright border accent | ||
| _TEXT_PRIMARY = "#E8EDF5" # primary text | ||
| _TEXT_SECONDARY = "#8892B0" # secondary text | ||
| _TEXT_MUTED = "#4A5580" # muted text |
Updated .gitignore to include and exclude specific directories and files.
RenanGBarreto
added a commit
that referenced
this pull request
Jul 7, 2026
Resolve modify/delete conflict on AGENTS.md by keeping the deletion (CLAUDE.md is the canonical home). Fold main's new Token efficiency section into CLAUDE.md. Update worktree map to reflect the gui.py -> gui/ package split from PR #84.
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.
Split the monolith gui.py into a focused package
🤔 Why?
mkpfs/gui.pyfile had grown past 1800 lines. Mixing theme config, translations, widgets, and six different operation panels in one file made it hard to navigate and risky to edit.🔧 What changed
gui/package with one file per concern:theme.py,i18n.py,widgets.py,app.py, and apanels/folder with a module for each operation.mkpfs/gui.pywas removed. Themkpfs-guientry point still works becausegui/__init__.pyre-exportsmain()fromapp.py.🧪 How to test
uv run mkpfs-gui— all six panels load as before.uv run --frozen pytest— all 379 tests pass.💬 Notes for non-technical readers