Skip to content

Merge dev to master#3

Merged
Redstoneur merged 11 commits intomasterfrom
dev
Feb 18, 2026
Merged

Merge dev to master#3
Redstoneur merged 11 commits intomasterfrom
dev

Conversation

@Redstoneur
Copy link
Owner

This pull request improves code organization and readability in the pymacrorecorder application, especially in the UI construction and event handling logic. It also enhances the project documentation with informative badges and minor usability tweaks.

Code refactoring and maintainability:

  • Refactored the UI construction in pymacrorecorder/app.py by splitting _build_ui into smaller, focused methods (_build_control_bar, _build_repeat_frame, _build_preview_tree, _build_log_area, _build_hotkey_editor), each with clear docstrings. This makes the codebase easier to maintain and extend. [1] [2] [3]
  • Improved the event deletion logic in pymacrorecorder/app.py by extracting checks and operations into _can_delete_events, _perform_deletion, and _log_deletion_result helper methods, clarifying responsibilities and improving readability.

Event handling improvements:

  • Refactored _apply_event in pymacrorecorder/player.py to use a handler dispatch dictionary and moved each event type’s logic into its own method (_handle_key_down, _handle_key_up, _handle_mouse_click, _handle_mouse_scroll, _handle_mouse_move), making the code more modular and easier to extend. [1] [2]

Documentation and usability:

  • Enhanced README.md with project badges for license, language, Python version, repo size, contributors, commit status, issues, pull requests, forks, stars, watchers, releases, build status, and code quality, making project status and metadata more visible to users and contributors.
  • Minor usability improvement in build.ps1 by using Write-Output instead of Write-Host for build completion messages, which improves script output handling.

Documentation clarity:

  • Added or clarified docstrings throughout the refactored methods for improved code documentation and developer onboarding. [1] [2] [3] [4] [5] [6]

Adds a collection of shields and badges to the README to surface repository metadata and CI/quality status. Badges include license, top language, Python version (3.14.0), repo size, contributors, last commit, issues, pull requests, forks, stars, watchers, latest release and release date, plus CI build and Codacy grade. Visual separators (---) were added to group badge sections and improve header presentation.
Update minimum versions in requirements.txt: pyinstaller upgraded to >=6.19.0 and pyinstaller-hooks-contrib to >=2026.0. This ensures the project uses newer PyInstaller tooling and hook updates; other requirements remain unchanged.
Replace Write-Host with Write-Output in build.ps1 so the final build message goes to the PowerShell pipeline/standard output rather than directly to the host. This allows the message to be redirected or captured (useful for CI/logging) without changing the reported path or other behavior.
Add blank lines around headings, lists, and code blocks in README.md to improve readability and visual separation between sections (Features, Structure, Quick start, Save & config, Default hotkeys). No functional content changes.
Extract helper methods in App to handle deletion checks, perform deletion and log results (_can_delete_events, _perform_deletion, _log_deletion_result). This centralizes deletion flow, clarifies logging, and ensures preview is updated after deletions. Replace large if/elif block in Player with a handler dispatch and separate methods for each event type (_handle_key_down, _handle_key_up, _handle_mouse_click, _handle_mouse_scroll, _handle_mouse_move) to improve readability and maintainability without changing behavior.
Annotate the local `handler` variable in Player.player to provide an explicit Callable union type when retrieving from the handlers mapping. This is a typing-only change to satisfy the type checker; there is no runtime behavioral change—handler is still looked up and invoked if present.
Split App._build_ui into smaller helper methods (_build_control_bar, _build_repeat_frame, _build_preview_tree, _build_log_area, _build_hotkey_editor) and added docstrings/return type hints. This improves readability and separates construction of the control bar, repeat input, preview tree, log area, and hotkey editor without changing behavior.
@Redstoneur Redstoneur self-assigned this Feb 18, 2026
Copilot AI review requested due to automatic review settings February 18, 2026 08:49
Explicitly initialize UI widget attributes (buttons, entry, treeview, log_text, repeat_var) and hotkey_labels in App.__init__ with type hints to avoid mypy/pylint complaints and potential attribute errors. Removed the duplicate hotkey_labels initialization from the hotkey frame builder. No functional behavior changes intended; this is a static typing / robustness cleanup.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR merges dev into master, focusing on refactoring the Tkinter UI construction and event-handling code to improve readability/organization, along with documentation and small build-script tweaks.

Changes:

  • Refactors App._build_ui into smaller UI-builder methods and extracts deletion logic into helpers.
  • Refactors Player._apply_event into a dispatch-based implementation with per-event handlers.
  • Updates documentation (badges) and adjusts build script output; bumps PyInstaller-related requirements.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
requirements.txt Updates minimum versions for PyInstaller and hooks contrib.
pymacrorecorder/player.py Replaces if/elif chain with handler dispatch + helper methods for event playback.
pymacrorecorder/app.py Splits UI construction into focused methods; refactors deletion flow into helpers.
build.ps1 Uses Write-Output for the completion message.
README.md Adds a badge section and minor formatting tweaks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Redstoneur and others added 3 commits February 18, 2026 09:54
Annotate handlers in Player with dict[str, Callable[[dict], None]] and replace the previous long union type for handler with Optional[Callable[[dict], None]]. This clarifies the expected payload signature, improves readability and static type checking without changing runtime behavior.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Change the README Python badge from a specific 3.14.0 value to a minimum requirement of >=3.10 to reflect supported Python versions.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fix deletion logging when removing selected events from the preview. Previously the code logged len(indexes) which could count selections that were out-of-range and not actually removed. This change adds a deleted_count that is incremented only when an event is popped and passes that value to _log_deletion_result so the logged count matches the real number of deletions.
@Redstoneur Redstoneur merged commit 9f4d494 into master Feb 18, 2026
4 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.

2 participants