Skip to content

Peter-L-SVK/pomodoro-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pomodoro Timer with Task Management

Pomodoro Timer Screenshot

A productivity application combining the Pomodoro technique with task management, designed for Linux (Fedora Cinnamon) with a clean, minimalist interface.

Features

  • Pomodoro Timer

    • 25-minute work sessions
    • 5-minute short breaks
    • 15-minute long breaks after 4 sessions
    • Visual circular progress indicator
    • Configurable timer durations
  • Task Management

    • Add/edit/delete tasks
    • Mark tasks as completed
    • Set current focus task
    • Task completion statistics
    • Persistent task storage
  • Productivity Tools

    • Break reminders (posture/stretch alerts)
    • Sound notifications
    • Visual completion tracking
    • Session statistics

Installation

Requirements

  • Python 3.x
  • Tkinter
  • Fedora/Cinnamon (or compatible Linux distro)
# Clone repository
git clone https://github.com/yourusername/pomodoro-timer.git
cd pomodoro-timer

# Install dependencies - Fedora
sudo dnf install python3-tkinter alsa-utils pulseaudio-utils libnotify

#Ubuntu/Mint 
sudo apt install python3-tk

# Run the application
python3 pomodoro.py #or ./pomodoro.py

Usage

  1. Timer Tab:

    • Start/Pause/Reset timer
    • View current task
    • See completion progress
    • Adjust timer settings
  2. Tasks Tab:

    • Add new tasks with Enter task... placeholder
    • Set current task
    • Delete tasks
    • View completion statistics
  3. Menu:

    • Toggle break reminders
    • Configure notification sounds

Configuration

Modify timer durations in the Settings section:

  • Work time (default: 25 min)
  • Short break (default: 5 min)
  • Long break (default: 15 min)

Choose notification sounds:

  • System beep
  • Bell sound
  • Full alert (visual+audio)

Troubleshooting

Sound not working?

sudo dnf install alsa-utils pulseaudio-utils

# Ubuntu/Mint
sudo apt install pulseaudio-utils alsa-utils

Note: Ubuntu/Mint typically include PulseAudio by default, but these ensure CLI tools are installed.

Missing fonts?

sudo dnf install google-noto-sans-fonts

#Ubuntu/Mint
sudo apt install libnotify-bin

Window not displaying properly? Try running with basic theme:

self.style.theme_use("default")  # Change in code

Testing

The application includes a comprehensive test suite using pytest to ensure reliability and functionality.

Test Requirements

# Install testing dependencies
pip install pytest pytest-cov

# Or from requirements file
pip install -r requirements-test.txt

Running Tests

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run with coverage report
pytest --cov=pomodoro --cov-report=html

# Run specific test file
pytest test_pomodoro.py

# Run tests matching specific pattern
pytest -k "test_timer" -v

Test Coverage

The test suite covers:

  • Timer Functionality: Start, pause, reset, and mode transitions
  • Task Management: Adding, selecting, deleting, and completing tasks
  • Settings: Validating and applying timer duration changes
  • Sound System: Notification playback and error handling
  • File Operations: Saving and loading tasks from JSON storage
  • UI Components: Placeholder text, task colors, and statistics display
  • Edge Cases: Invalid inputs, error conditions, and boundary values

Test Structure

test_pomodoro.py
├── TestPomodoroTimer
│   ├── test_initialization() - Verify default values
│   ├── test_timer_controls() - Start/pause/reset functionality
│   ├── test_mode_transitions() - Work/break mode switching
│   ├── test_task_management() - CRUD operations for tasks
│   ├── test_task_completion() - Marking tasks as done
│   ├── test_settings_application() - Config changes
│   ├── test_break_reminder() - Posture check notifications
│   ├── test_sound_playback() - Audio notifications
│   └── test_task_persistence() - File save/load operations

Continuous Integration

The tests can be integrated into CI/CD pipelines. Example GitHub Actions configuration:

name: Tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.x'
      - run: pip install pytest pytest-cov
      - run: pytest --cov=pomodoro

Writing New Tests

When adding new features, include corresponding tests:

def test_new_feature(app):
    # Setup
    app.new_feature_property = "value"
    
    # Execute
    result = app.new_feature_method()
    
    # Verify
    assert result == expected_value

Mocking External Dependencies

Tests use mocking for GUI elements and system calls to ensure isolated, reliable testing:

with patch('pomodoro.messagebox.showinfo') as mock_info:
    app.view_stats()
    mock_info.assert_called_once()

This approach allows testing without triggering actual GUI dialogs or system notifications during test execution.

License

MIT License - Free for personal and commercial use


Adapt the Pomodoro durations and notification preferences to match your workflow!