HoraLog is a simple, self-hosted web application built with Python and Gradio to help you track the time you spend on different projects throughout the day.
- Real-time Clock: Displays the current time, updating every second.
- Project Management:
- Add new projects to your list.
- Remove projects from the list.
- Project list persists in
projects.txt.
- Work Logging:
- Start tracking time for a selected project with an optional activity description.
- Stop tracking time for the currently running project.
- Concurrency Control: Prevents starting a new task if another task is already running.
- State Validation: Prevents stopping a task if no task is running or if the wrong project is selected.
- Log History: Displays a table of all start/stop events.
- Duration Calculation: Shows the calculated duration (
HH:MM:SS) for each completed work interval in the history. - Live Daily Total: Displays the total hours worked today (
HH:MM:SS), updating in real-time if a task is active. - Persistent Storage: Work logs are saved to
work_log.csv. - Manual Refresh: A button to manually refresh the log history display.
- Simple Web UI: Runs as a local web server accessible from your browser.
- Python: Version 3.8 or higher recommended.
- pip: Python package installer (usually included with Python).
-
Clone or Download:
git clone https://github.com/weberhen/horalog cd horalog -
(Recommended) Create a Virtual Environment:
# For Linux/macOS python3 -m venv venv source venv/bin/activate # For Windows python -m venv venv .\venv\Scripts\activate
-
Install Dependencies: Install the required Python libraries using pip.
pip install gradio pandas
- Navigate: Open your terminal or command prompt and navigate to the
horalogdirectory wheremain.pyis located. - Run: Execute the main script:
python main.py
- Access: The terminal will show output like:
Open your web browser and go to
Running on local URL: http://0.0.0.0:7860http://127.0.0.1:7860orhttp://localhost:7860. If you see0.0.0.0, you might also be able to access it from other devices on your local network using your computer's local IP address (e.g.,http://192.168.1.100:7860). - Stop: To stop the application server, go back to the terminal where it's running and press
Ctrl + C.
- Add Projects: Use the "Project Name" text box under "Manage Projects" and click "Add Project". Your projects will appear in the main "Project" dropdown and be saved to
projects.txt. - Select Project: Choose the project you are about to work on from the "Project" dropdown under "Log Work".
- Start Work: Optionally type a description in "Activity Description", then click "Start Work". The button will become disabled, and the "Stop Work" button will become enabled. The "Total Hours Today" counter will start incrementing if this is the first task of the day or continue from previous intervals.
- Stop Work: When you finish working on the currently running task, ensure the correct project is still selected in the dropdown, then click "Stop Work". The "Start Work" button will become enabled again, and the "Stop Work" button will disable. The log history will update, showing the calculated duration for the interval you just finished.
- Switch Tasks: To switch directly from Project A to Project B:
- Select Project A and click "Stop Work".
- Select Project B and click "Start Work".
- Remove Project: Select a project from the main "Project" dropdown and click "Remove Selected" under "Manage Projects".
- Refresh History: Click the "🔄 Refresh Log History" button if you need to manually reload the log display from the CSV file (e.g., if you manually edited the file).
The application uses two simple text files for persistence, created in the same directory as main.py:
projects.txt: A plain text file storing your project names, one per line.work_log.csv: A Comma-Separated Values file storing your work history. Columns include:Timestamp: Date and time of the event (YYYY-MM-DD HH:MM:SS).Project: The name of the project.Activity: The optional description entered.Type: Indicates if the entry is a 'Start' or 'Stop' event.
Important: Back up these files regularly if your time tracking data is critical!
- Editing or deleting past log entries.
- Filtering or searching the log history.
- Basic reporting (e.g., weekly totals per project).
- More visual feedback about the currently running task.
- User accounts / authentication (if needed for multiple users).
