EgonTE 1.13.1 - Tools revolution 🔨
description
In this update, (mainly) many existing tools in the "EgonTE.py" file were separated into their own files. In addition, the tools got a massive (mostly backend) improvement.
The tools that got the update are: git, encryption, web scraping, find & replace, file template generator.
(and the transcript tool, which got a relatively small update).
(there is also a threading management improvement).
Summary:
Git tool:
The tool is safer (secret/size checks, allowlists, confirmations), more reliable (validation and guarded GitPython usage), more responsive (threading for long tasks), and cleaner (modular and easier to maintain), while keeping the familiar UI and workflow.
Encryption tool:
A faster, more robust encryption/decryption pop-up that:
Doesn’t freeze under RSA workloads.
Produces clean, portable results.
Has a consistent look-and-feel and better usability.
Offers full local clipboard controls (copy/cut/paste/select all) in the tool itself.
Maintains compatibility with existing code by preserving public member names.
Web scraping tool:
The tool is safer (legal and technical), clearer (initial window), more robust (validation, scoping, and limits), and easier to extend (IDs and hooks). It provides a cleaner UI/UX with organized tabs and a single output area that reports results and HTTP status succinctly.
Find and replace tool (detailed & summarized):
Moved into a new file ("EgonTE.py" to find_replace_popup.py").
Replaced many Tk widgets with ttk.
File template generator:
Descriptive names and structured helpers.
Themed controls, keyboard shortcuts, and better messaging.
Stronger validation and safer file handling.
Transcript tool (no new standalone file):
The method is safer (no destructive file operations), clearer (better names/structure), and more user-friendly (interactive selection window).
YouTube input is integrated into the selection window.
Overall reliability improved through dedicated error handling paths and resource cleanup.
Other additions:
Fixed and improved some threading to make the program smoother and stable (including "stopwatch" and "check version" threads ).
Detailed patch notes:
The git tool:
Core fixes and reliability
Corrected repo-opening condition so “clone” skips local repo selection.
Switched to directory pickers for repos and clone target.
Fixed execute path to use repo.git.execute with safe parsing.
Corrected commit data usage (no shadowing; correct “Summary” label).
Added defensive try/excepts around Git calls with user feedback.
Safety-first upgrades
Strict clone URL validation:
Allow only safe schemes (https, ssh, git, file).
Reject embedded credentials in URLs.
Repo path validation: ensure selected folder is a Git repo; auto-detect root.
Execute hardening: allowlist of read-only subcommands only (status, log, branch, rev-parse, show, diff, ls-files, remote, describe).
Confirmations for impactful actions (add, commit, pull, clone into a non-empty folder).
Commit safeguards:
Block empty message unless user explicitly confirms (fallback to a safe default).
Require staged changes before committing.
Pre-commit scan:
Likely secrets (private keys, tokens, API keys, passwords).
Large staged files (warn on ≥10MB).
Pull safety: if the working tree is dirty, offer to stash before pulling (or cancel).
PII protection: redact emails in outputs shown to the user.
UI/UX and responsiveness
Non-blocking long ops (clone, pull) via a background thread with a tiny progress popup and completion message.
Improved error/info messages, consistent titles, and simple progress feedback.
Reused the existing rich text box for showing repo info and command output.
Feature tidying
“Add” uses git add --all with confirmation.
“Commit data” shows safe, redacted author info and basic commit stats.
“Execute” results can display in the same UI (when opened) without blocking.
Refactoring and modularization
Extracted the Git tool into a dedicated module (git_tool_popup.py) to match other popup tools.
Left a thin wrapper in the main file that delegates to open_git_tool(app, action).
The new module is self-contained: availability checks, safety helpers, a threading wrapper, and UI integration via the app’s existing helpers.
Encryption tool:
Core improvements:
Output correctness
Ensured the output box shows only the result:
Encrypt: Base64 ciphertext only.
Decrypt: plaintext only.
UX and responsiveness:
Threaded RSA key generation and encryption to avoid freezing the UI.
Added a busy state (disables controls + watch cursor) during RSA work.
Pre-validated RSA plaintext size (based on key size and padding) to prevent OverflowError and provide clear hints.
Enforced a minimum key size (2048 bits) and added an optional upper guard for usability.:
Text widgets upgrade - Switched input and output widgets from native Tk.Text to the improved "make_rich_textbox" method:
Clipboard and context menus (tool-local)
Added right-click context menus for both input and output:
Input: Copy, Cut, Paste, Select All.
Output: Copy, Select All (respects disabled state).
Added keyboard shortcuts: Ctrl+C and Ctrl+A on both; Ctrl+X and Ctrl+V on the input box.
Error handling and clarity
Clear error messages across most possible errors:
Safer numeric parsing for RSA key length.
Base64 decoding guarded with helpful feedback (no raw tracebacks).
Behavior and defaults now
Defaults to Encrypt + first available method (symmetric preferred if available).
For symmetric:
Generates a new Fernet key and encrypts; decrypt uses the in-session key.
If ciphertext is provided (Base64), decrypts it directly when the key exists.
For asymmetric:
Encrypt expects key length in the entry; decrypt expects a private key in the PEM box (or uses the in-session key).
Uses threading for keygen/encrypt, validates plaintext size before encrypt.
UI changes at a glance
Output is disabled (read-only) except when writing programmatically.
Right-click context menus and familiar shortcuts in both text areas.
Web scraping:
Architecture and refactor
Extracted the old inline method into a dedicated module (web_scrapping_popup.py) with a thin delegator, improving separation of concerns and testability.
Centralized state and helper functions to eliminate global leakage and UnboundLocalError risks; ensured helpers are defined before being used.
Safety and compliance (major hardening)
Added a single, consolidated legal disclaimer shown once per session; made user authorization and responsibility explicit.
Enforced safe-by-default networking with toggles: HTTPS-only, block credentials in URL, block IP-literal/private/reserved hosts (anti-SSRF), same-origin redirect policy.
Respected robots.txt (toggle), warned on restrictive meta robots, and implemented a content-type allowlist and streaming with size limits to avoid large/binary downloads.
Sanitized HTML before display/insert by stripping scripts/iframes/inline event handlers and blocking JavaScript: URLs.
Initial window and UX improvements
Rebuilt the initial selector as a compact, independent popup with clear labels: “Scrape website by link,” “Scrape current editor (this file),” and “Scrape a local HTML/TXT file, and in a scenario of a "Scrape by link" added a hidden label that will show up instead of another popup.
Assigned meaningful developer IDs to key widgets (inputs/buttons) and added explicit handler hooks to ease future customization.
Main UI and layout polish
Organized the main pop-up using a ttk.Notebook with three tabs: “Filters & Return,” “Options,” and “Safety & Legal” for improved navigation.
Ensured the window uses a scrollable output area that expands properly; placed a “Result info” line with count, size, and HTTP status/redirect hints.
Behavioral fixes and flow corrections
Prevented premature search calls before UI exists; now initial search runs automatically only after the main UI is created and content is available.
Replaced stacked outputs with a single, replaced output pane to avoid clutter.
Limited external tab openings to robots.txt and, optionally, only one Terms page after a quick availability check and user consent, eliminating tab-spam.
Developer experience and maintainability
Marked logical extension points (validation, post-link actions, selector events) for custom event handler code.
Added defensive guards and straightforward error handling with user-friendly messages.
Reduced duplicate prompts and shadowed functions; aligned variable naming and scoping to prevent runtime errors.
Transcript:
Key iterations and improvements
Safer audio conversion:
Stopped renaming the original MP3; converted to a separate WAV file instead.
Added cleanup for temporary/converted wav when possible.
Robust error handling:
Clear messages for unsupported file types, preparation/conversion errors, and transcription failures.
Guarded UI cleanup when errors occur (attempt to close created windows).
Consistent UI builders:
Root windows are created via the "make_pop_ups_window" method.
Text display areas are built via the "make_rich_textbox" method, with a Copy button and read-only state.
YouTube input integrated into the selection window:
Replaced the modal input prompt with an Entry field embedded in the selection window.
Added Fetch, Clear, and Paste controls and a status label for inline feedback.
Pressing Enter in the Entry triggers fetching the transcript.
More interactive selection window:
Two clearly separated sections: YouTube and Local audio.
Descriptive labels and better layout.
A Close button and improved spacing/organization.
File template generator:
Moved from "EgonTE.py" to a dedicated pop-up file ("file_template_generator_popup.py").
The original method kept as a thin delegator to open the standalone pop-up
Split monolithic logic into focused helpers (dependencies, presets, output paths, generators)
Clear orchestration deciding which generator to run (PDF, Word, Jinja, docxtpl)
Light quality-of-life shortcuts (e.g., Enter to generate, Esc to close)
Clear, descriptive names for functions and state