# pyPhotoAlbum

A Python (PyQt6) application for designing photo albums and exporting them to PDF.

## Features

### Core Features
- [x] Basic application structure with OpenGL rendering
- [x] Menu system (File, Edit, View)
- [x] Toolbar and status bar
- [x] Page layout controls (custom sizes, DPI settings, page management)
- [x] Template pages with grid layouts
- [x] Image drag-and-drop from file explorer
- [x] Image auto-scaling and center-crop fitting
- [x] Image rendering with OpenGL textures
- [x] Object selection, moving, and resizing
- [x] Mouse wheel zoom (10%-500%)
- [ ] Interactive cropping with constrained movement
- [ ] Text box support with rotation
- [ ] Undo/redo functionality
- [ ] PDF export
- [ ] XML project save/load

### Additional Features
- [ ] Grid cell merging for spanning photos
- [x] Double-page spread flag (rendering not yet implemented)
- [ ] Default minimum distance between images
- [x] Page numbering system
- [x] Add/Remove pages dynamically
- [ ] Background color/pattern options
- [ ] Theme presets

## Technical Stack
- Python 3.9+
- PyQt6 for GUI
- OpenGL for rendering
- ReportLab for PDF generation
- lxml for XML serialization
- Pillow for image processing

## Installation

### For Users

Install the package using pip:
```bash
pip install .
```

Or for an editable installation (development):
```bash
pip install -e .
```

After installation, you can run the application with:
```bash
pyphotoalbum
```

### For Developers

1. Clone the repository:
   ```bash
   git clone <your-repo-url>
   cd pyPhotoAlbum
   ```

2. Create virtual environment:
   ```bash
   python -m venv venv
   ```

3. Activate virtual environment:
   - Windows: `venv\Scripts\activate`
   - Linux/macOS: `source venv/bin/activate`

4. Install in development mode with dev dependencies:
   ```bash
   pip install -e ".[dev]"
   ```

## Running the Application

After installation, run:
```bash
pyphotoalbum
```

Or, for development, you can still run directly:
```bash
python pyPhotoAlbum/main.py
```

## Testing

### Running Tests

Run all tests with coverage:
```bash
pytest
```

Run tests with verbose output:
```bash
pytest -v
```

Run specific test file:
```bash
pytest tests/test_models.py
```

Run tests with coverage report:
```bash
pytest --cov=pyPhotoAlbum --cov-report=html
```

Then open `htmlcov/index.html` in your browser to view the coverage report.

### Continuous Integration

The project uses Gitea Actions for CI/CD:
- **Tests**: Runs on Python 3.9, 3.10, and 3.11 on every push
- **Linting**: Checks code quality with flake8, black, and mypy

View workflow status in your Gitea repository's Actions tab.

## Project Structure

```
pyPhotoAlbum/
├── main.py           # Main application entry point
├── requirements.txt   # Python dependencies
└── README.md          # Project documentation
```

## Development Roadmap

1. **Phase 1: Core Functionality**
   - Complete page layout controls
   - Implement template system
   - Add image handling capabilities
   - Implement text box support

2. **Phase 2: Advanced Features**
   - Add undo/redo functionality
   - Implement PDF export
   - Add XML project serialization

3. **Phase 3: Polish and Optimization**
   - Optimize rendering performance
   - Add additional UI polish
   - Implement comprehensive testing
