Skip to content

Solaceking/Testbuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TestBuddy - Professional Screenshot to Text Converter

TestBuddy is a production-grade OCR application for Windows that converts screenshots directly into editable text. Built with PyQt6 and Tesseract OCR, it provides a seamless workflow for extracting text from images.

Features

Core Functionality

  • πŸ“Έ Quick Screenshot Capture β€” Ctrl+Shift+S to launch screenshot tool
  • πŸ”€ Accurate OCR β€” Uses industry-standard Tesseract OCR engine
  • πŸ“‹ Easy Clipboard Integration β€” Ctrl+C to copy extracted text
  • πŸ”§ Editable Output β€” Modify OCR results in the built-in editor
  • πŸ’Ύ Session Export β€” Save extracted text to file

Advanced Capabilities

  • Multi-Language Support β€” Configure OCR for 100+ languages
  • Persistent History β€” Automatic session tracking with full-text search
  • Configuration System β€” Customize all settings via INI file
  • Keyboard Shortcuts β€” Full keyboard support for power users
  • Activity Logging β€” Debug console with detailed operation logs
  • Type-Safe Codebase β€” Full Python type hints for maintainability

System Requirements

  • OS: Windows 10/11
  • Python: 3.8+
  • Tesseract-OCR: Required (see Installation)

Installation

1. Install Tesseract-OCR

Windows:

2. Clone/Setup TestBuddy

cd c:\Users\idavi\Documents\Projects\testbuddy
pip install -r requirements.txt

3. Run Application

python main.py

First Run: The app creates testbuddy.ini with default settings.

Configuration

Edit testbuddy.ini to customize behavior:

[tesseract]
path = C:\Program Files\Tesseract-OCR\tesseract.exe
language = eng                    # ISO 639-3 code (eng, fra, deu, jpn, etc.)
psm = 6                           # Page Segmentation Mode
oem = 3                           # OCR Engine Mode

[ui]
window_width = 900
window_height = 600
window_always_on_top = True
theme = light                     # (light/dark planned)
splitter_ratio = 600

[behavior]
clipboard_poll_interval_ms = 500
log_buffer_size = 100
auto_copy_on_ocr = False

[history]
enable_history = True
max_entries = 100
file = testbuddy_history.json

[export]
format = txt
directory = exports

[logging]
file = testbuddy_debug.log
debug_mode = False

Usage

Basic Workflow

  1. Click camera button (πŸ“·) or press Ctrl+Shift+S
  2. Windows Snipping Tool opens β€” capture text area
  3. OCR processes automatically when clipboard updated
  4. Edit text in the editor if needed
  5. Copy result β€” Ctrl+C or click "COPY TEXT" button
  6. Export session β€” Save to file with button

Keyboard Shortcuts

Shortcut Action
Ctrl+Shift+S Take screenshot
Ctrl+C Copy extracted text

History & Sessions

  • History Button: View last 10 OCR sessions with previews
  • Auto-Saved: All results saved to testbuddy_history.json
  • Search Ready: History entries can be searched programmatically

File Structure

testbuddy/
β”œβ”€β”€ main.py                 # Main application
β”œβ”€β”€ config.py              # Configuration management
β”œβ”€β”€ history.py             # Session history & persistence
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ testbuddy.ini         # Settings (generated)
β”œβ”€β”€ testbuddy_history.json # History log (generated)
β”œβ”€β”€ testbuddy_debug.log   # Activity log (generated)
β”œβ”€β”€ exports/              # Exported sessions (generated)
└── README.md

Roadmap

Phase 2 (Features)

  • Configuration system
  • Keyboard shortcuts
  • Persistent history
  • Type hints
  • Image preview before OCR
  • Multi-language selector in UI
  • Undo/Redo text editing
  • Dark mode

Phase 3 (Advanced)

  • Batch processing (multiple images)
  • CSV/JSON export formats
  • OCR result corrections & training
  • System tray integration

Phase 4 (Professional)

  • Unit tests & CI/CD
  • Packaging (setup.py, pyproject.toml)
  • Auto-updater
  • Windows installer (.msi)

Architecture

Module: config.py

  • ConfigManager: Loads/saves INI configuration
  • Config: Data class with all settings
  • Validates all settings and provides sensible defaults

Module: history.py

  • HistoryManager: Persistent JSON-based history
  • HistoryEntry: OCR session metadata & full text
  • Features: Add, search, delete, export statistics

Module: main.py

  • OCRWorker: QThread subclass for non-blocking OCR
  • SnapOCRApp: Main PyQt6 window
  • Integrates config, history, and all UI components

Troubleshooting

Tesseract Not Found

Error: File not found: C:\Program Files\Tesseract-OCR\tesseract.exe

Fix: Update tesseract.path in testbuddy.ini to your actual Tesseract location.

OCR Produces Empty Output

  1. Check testbuddy_debug.log for errors
  2. Try with simpler text image
  3. Different PSM modes: 6 (uniform), 3 (auto), 11 (sparse)
  4. Configure language: language = eng+fra for English+French

History File Corrupted

rm testbuddy_history.json  # Delete and restart app

Slow Clipboard Polling

Increase clipboard_poll_interval_ms in config (500ms default).

Development

Adding Type Hints

All functions are type-hinted for IDE support and debugging:

def process_image(image: Image.Image, language: str) -> str:
    """Process image and extract text."""

Extending History

from history import HistoryManager

history = HistoryManager()
history.add_entry("Extracted text", language="eng", tags=["important"])
results = history.search("keyword")

Custom OCR Config

Edit tesseract section in config.py:

config.ocr_psm = 6  # Layout-aware
config.ocr_oem = 3  # Use both legacy & LSTM engines

Performance Metrics

  • OCR Time: 1-3 seconds depending on image complexity
  • Memory Usage: ~150MB idle, ~300MB during OCR
  • History Storage: ~2KB per entry

License

[Add your license here]

Contributing

Contributions welcome! Areas for help:

  • GUI improvements & themes
  • Language pack support
  • Performance optimization
  • Documentation expansion
  • Testing & CI/CD setup

Support

For issues, check:

  1. testbuddy_debug.log for error details
  2. Tesseract documentation: https://github.com/UB-Mannheim/tesseract/wiki
  3. PyQt6 issues: https://www.riverbankcomputing.com/software/pyqt/

Version: 1.0.0
Last Updated: December 2025
Status: Production Ready (Phase 1 Complete)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors