$ show PantsuDango/Dango-Translator
This repository is a legacy Python desktop application for real-time screen and image (manga) translation built with PyQt5. It captures screen regions or loads images, performs OCR using online/offline/Baidu/PaddleOCR engines, translates text via multiple APIs (Youdao, Baidu, Tencent, Caiyun, ChatGPT, etc.), and displays results. The architecture is monolithic with heavy use of threading for background tasks, custom PyQt5 widgets (switches, progress bars), and SQLite for translation history. The codebase is Windows-centric, relies on external APIs and Selenium drivers, and is no longer actively maintained after a Go rewrite (v4.5.8+).
The LLM identified 4 files worth highlighting for reuse:
Provides a wrapper for threading.Thread and QThread with daemon handling, enabling safe execution of background tasks in PyQt5 applications. Includes specialized threads for auto-login, version checks, and manga translation progress. Isolated and reusable with minimal modification.
Contains custom switch widgets (SwitchButton, OfflineSwitch, SwitchOCR) that encapsulate gradient background, sliding knob, label, and a checkedChanged signal. Used throughout the UI for binary options and extractable for reuse in other PyQt5 projects.
Handles loading/saving YAML configuration, applying defaults, converting legacy keys, and whitelisting allowed keys. Includes cloud sync functionality. Self-contained configuration management component suitable for extraction.
Implements a translation worker that caches results (via SQLite) to avoid re-translating identical strings, applies a filter list, and selects the appropriate translation source. Includes helpers for drawing translated text onto screenshots. Demonstrates separation of concerns and caching strategy.