How datavorous/amine works
Project Type and Purpose
• This is a standalone desktop “focus” application (Pomodoro + distraction blocker) built with Python and Flask, wrapped into a desktop GUI via FlaskWebGUI. Its goal is to serve a local web interface, enforce fullscreen on a target website, block distracting key combos and mouse movements, and run concurrent timer/mouse‐monitor threads.
File Structure
• Top-level:
• webapp.py – entrypoint for the Flask application
• index.html – a static landing page or backup UI
• pyproject.toml – Poetry configuration
• LICENSE, README.md, .gitignore
• amine/ (package):
• __init__.py – package marker
• webapp.py – main Flask server and GUI integration
• templates/*.html – front-end pages (index, data, help)
• tests/ – unit tests
• Absence of “static/” implies CSS and JS come via CDN (Tailwind) and inline scripts.
README for Additional Insights
• Backend: Python & Flask
• Frontend: HTML, JavaScript, Tailwind CSS via CDN
• GUI wrapper: FlaskWebGUI (likely embedding a Chromium/Edge WebView)
• Concurrency: Python threads (timer thread + mouse‐monitor thread)
• OS integration:
• keyboard library for low-level key blocking
• pygetwindow for window manipulation (fullscreen)
• pyautogui for initial click and mouse enforcement
• winsound for audio cues
a. Main Components
1. User Machine (Host OS)
2. Desktop App Container (FlaskWebGUI)
3. Web Server (Flask App)
4. Frontend UI (Templates + JS + Tailwind)
5. Timer & Mouse Monitor Threads
6. OS Integration Layer (keyboard, pygetwindow, pyautogui, winsound)
b. Relationships and Interactions
• User ↔ GUI WebView: user inputs Pomodoro parameters, clicks Start
• GUI WebView → Flask routes: HTTP POST to /start, /stop, ping endpoints
• Flask main thread dispatches:
• TimerThread – manages focus/break durations, triggers winsound
• MouseMonitorThread – polls mouse coordinates, calls pyautogui to confine cursor
• OS Integration Layer invoked by threads to block keys or enforce fullscreen
• Flask returns real-time status updates (via server-sent events or repeated AJAX) to the UI
c. Architectural Patterns and Principles
• MVC-ish separation:
• Views = HTML templates
• Controller = Flask route handlers
• Model = in-memory session state (no persistent storage)
• Concurrency for isolation: separate threads for UI vs. blocking logic
• Single binary deploy: Poetry bundles all dependencies; no external DB
d. Key Technologies and Frameworks
• Python 3.x, Flask, threading
• FlaskWebGUI (desktop WebView container)
• keyboard, pygetwindow, pyautogui, winsound
• Tailwind CSS (CDN), vanilla JavaScript for UI logic