New features & Better code health π
π¨ Egon Draw - Update 3 Patch Notes
This update focuses on expanding the toolset with precision features, adding asset support, and introducing session tracking, alongside significant under-the-hood refactoring for better stability.
π New Features
π§² Magnet Tool
- What it is: A precision movement tool.
- How it works: Allows you to drag selected items relative to a reference point (your mouse click). It acts like a magnet, pulling items towards the cursor or moving them with arrow keys.
- Controls: Toggle with the "Magnet" button. Use
Mouse DragorArrow Keysfor fine adjustments.
πΌοΈ Bitmap (Icon) Support
- What it is: Native support for inserting system bitmaps.
- Details: Added a dedicated "Add Bitmap" section.
- Library: Includes standard icons like
error,info,question,hourglass, and more.
π Usage Statistics Dashboard
- What it is: A new popup dashboard to track your drawing session.
- Metrics Tracked:
- β±οΈ Session Duration: Tracks active time using a non-blocking background thread.
- ποΈ Most Used Tool: See which brush you favor.
- π¨ Most Used Color: See your dominant palette.
- π Line Count: Total number of lines drawn.
ποΈ Edit Color Mode
- What it is: The ability to modify the color of items after they are drawn.
- How it works: Click "Edit color", select a new color, and click any item on the canvas to repaint it instantly.
π UI & UX Improvements
- Responsive Window Sizing: Implemented
effective_size()logic. The application now dynamically calculates the optimal window size and position based on your screen resolution (1080p, 1440p, etc.), ensuring UI elements aren't cut off. - GitHub Integration: Added a direct link button to the project repository for easy access to source code and updates.
- Layout Reorganization: Introduced
bit_frameandbonus_frameto cleanly organize the growing number of tools, preventing UI clutter.
π§ Technical Refactoring (Under the Hood)
Core Logic Split (add_special β active_add)
- The Change: The monolithic
add_specialmethod was refactored. The execution logic was extracted into a new, standaloneactive_addmethod. - The Benefit: This decoupling makes the code modular. It allowed for the easy integration of Bitmaps without duplicating code and simplifies future additions (e.g., new shape types).
Robust State Management
- The Change: Enhanced
deactivate()anddraw_tool()methods. - The Benefit: Switching tools is now safer. The system explicitly unbinds events and resets cursors when moving between complex modes (like Magnet) and standard tools (like Pencil), preventing "stuck" states.
Performance & Stability
- Thread Safety: The usage timer (
stopwatch) now usesafter()to update the UI on the main thread, preventing race conditions and crashes. - Error Handling: Added robust error catching for image uploads (corrupt files) and PDF saving (missing dependencies).
- Daemon Threads: Background tasks now close cleanly when the application exits.
π Bug Fixes
- Import Handling: Added missing imports (
simpledialog,webbrowser) to prevent runtime errors when accessing new features. - Mode Safety: Added checks to ensure
last_activemodes are properly cleared before starting new actions. - Input Validation: Fixed potential errors when cancelling text input dialogs.