Skip to content

Latest commit

 

History

History
156 lines (128 loc) · 6.04 KB

File metadata and controls

156 lines (128 loc) · 6.04 KB

TextFileCompareApp

A simple, small desktop app for comparing, merging, and sharing text files with a clean side‑by‑side diff view and optional word‑level highlights. It runs locally on your machine (no data leaves your PC) and is friendly for both non‑technical and technical users.


✨ Why you’ll like it

  • Fast, lightweight, and offline.
  • Side‑by‑side comparison with clear added/removed line highlighting.
  • Word‑level diffs (optional) to spot small changes within a line.
  • Drag & drop files straight into either pane (if tkinterdnd2 is installed).
  • One‑click final selection: keep File 1, keep File 2, or save a Merged version.
  • Share anywhere: save to file, copy to clipboard, send via Email or WhatsApp, with smart fallbacks for very long content.
  • Themes: Light, Dark, and Sepia.
  • Keyboard shortcuts and linked scrolling to speed up reviews.
  • Local license/activation logic that mirrors your Text File Searcher and DataPrep‑Pro approach.
  • Settings persistence (remembers theme and window size).
  • Optional custom app icon (app_icon.ico or app_icon.png).

🧰 Features in detail

  • Compare & Merge
    • Load or paste two text files.
    • See line‑level differences (additions/removals) for quick scanning.
    • Toggle word‑level highlight for fine‑grained changes.
    • Choose a final output: File 1, File 2, or Merged content.
  • Drag & Drop (optional)
    • If tkinterdnd2 is available, drag files onto the File 1 or File 2 text areas.
    • If not installed, the app still works—use the Open File buttons or File menu.
  • Share the final content
    • Save to file or Copy to clipboard.
    • Share via Email or WhatsApp using your default apps.
    • For very long content, the app safely truncates or falls back by saving a temporary .txt and copying the full text to your clipboard so nothing is lost.
  • Theming & UX
    • Light, Dark, Sepia themes.
    • Linked scrolling between both panes.
    • Clear status messages in both main and comparison windows when you set the final selection.
  • Licensing (local, offline)
    • Mirrors your Text File Searcher and DataPrep‑Pro style:
      • Stores a small JSON file: file_comparator_license.json
      • Menu: License → Enter License Key / View License Status
      • Sample accepted keys in code (replace with your own): TFS-DEMO-2025, DP-DEMO-2025, or keys with prefix FCA- / TFS- / DP- and 4 parts.
    • Purely local—no network checks.

📦 Installation

Requirements

  • Python 3.8+
  • Tkinter (usually included on Windows/macOS).
    On Linux, you may need to install it, e.g.:
    # Ubuntu/Debian
    sudo apt-get update && sudo apt-get install -y python3-tk
  • Optional for drag & drop:
    pip install tkinterdnd2

Get the code and run

git clone https://github.com/ahmedkansulum/TextFileCompareApp.git
cd TextFileCompareApp
pip install -r requirements.txt      # installs tkinterdnd2 (optional but recommended)
python TextFileCompareApp.py

If you don’t want drag & drop, you can comment out tkinterdnd2 in requirements.txt and just use Open File buttons.


⌨️ Keyboard Shortcuts

  • Ctrl+1 – Open File 1
  • Ctrl+2 – Open File 2
  • Ctrl+M – Compare & Merge
  • Ctrl+S – Share Final Selection
  • Ctrl+T – Cycle Theme
  • F1 – About

🖼️ App Icon

  • Place an app_icon.ico (Windows) or app_icon.png (cross‑platform) in the app folder.
  • The app will try to load it automatically.

🔐 Local License / Activation

  • License → Enter License Key to activate.
  • Accepted keys are defined in the code (VALID_LICENSE_KEYS) and a pattern (e.g., FCA-xxxx-xxxx-xxxx). Replace with your own scheme.
  • A JSON file file_comparator_license.json is created/updated locally:
    {
      "key": "YOUR-LICENSE-KEY",
      "activated_on": "2025-11-12T20:00:00Z"
    }
  • No external calls; activation is offline.

🧪 Tips & Troubleshooting

  • Drag & Drop not working? Ensure tkinterdnd2 is installed. If it still fails, the app will gracefully fall back—just use the Open File buttons.
  • Email/WhatsApp long text errors (Windows “file path too long” / long URL):
    The app will truncate the in‑URL text (to keep the handler happy) and/or save the full content to a temporary .txt while copying the full text to your clipboard. You won’t lose any data.
  • Missing Tkinter on Linux: install python3-tk via your package manager.
  • Dark theme contrast: Buttons are styled to keep text readable (bold, white text on accent background).

🛠️ Build a one‑file EXE (Windows, optional)

Install PyInstaller:

pip install pyinstaller

Build:

pyinstaller --noconsole --name TextFileCompareApp --icon app_icon.ico --hidden-import tkinterdnd2 TextFileCompareApp.py

The executable will be in the dist/ folder.


📁 Project Structure (suggested)

TextFileCompareApp/
├─ TextFileCompareApp.py
├─ requirements.txt
├─ README.md
├─ app_icon.ico               # optional
└─ app_icon.png               # optional

🧾 Changelog

2025‑11‑12

  • Added drag & drop support (optional via tkinterdnd2).
  • Added word‑level diff toggle on the comparison window.
  • Improved status feedback inside the comparison window when selecting the final version.
  • Smarter Email/WhatsApp sharing with truncation and local fallback file.
  • Theme contrast and primary button readability improved.
  • Settings persistence (theme + window size).

🤝 Contributing

Issues and PRs are welcome. Suggestions for more share targets or improved diff algorithms are appreciated.


📜 License

This project mirrors your local license approach used in Text File Searcher and DataPrep‑Pro. Replace the in‑code demo keys and validation logic with your production scheme as needed.