Content
# Tool List
## Overview
The PrintQueueApp is an application for managing print queues for internal documents, allowing users to drag and drop XLSX/XLS/PDF files into the queue and manage their status through a WinUI 3 GUI.
- **Cross-platform**: Python part works on Windows/Mac/Linux
- **WinUI 3 GUI**: Modern native interface for Windows
- **MCP Protocol**: Flexible server/client separation using Model Context Protocol
- **Multi-format support**: Supports Excel (XLSX/XLS) and PDF files
## Architecture
```
┌─────────────────────────────────────────────────────────┐
│ Python PrintQueueApp (cross-platform) │
│ ├── Queue management │
│ ├── File processing (openpyxl, xlrd, PyMuPDF) │
│ └── Print execution (Windows API / lp) │
│ │ │
│ │ MCP (HTTP or stdio) │
│ ▼ │
│ WinUI MCP Server (C# / WinUI 3) │
│ ├── MCP tools → WinUI widget implementation │
│ └── GUI window hosting │
└─────────────────────────────────────────────────────────┘
```
## Features
### Queue Management
- Drag and drop file addition
- File list display in queue
- Individual/overall print operations
- Real-time display of print status
### Supported File Formats
| Format | Library | Notes |
|------|-----------|------|
| XLSX | openpyxl | Excel 2007+ |
| XLS | xlrd + xlwt | Excel 97-2003 (legacy) |
| PDF | PyMuPDF | Print as is or image |
### Print Pipeline
```
PENDING → PROCESSING → PRINTING → DONE / ERROR
```
## Quick Start
### Prerequisites
- **Python 3.11+**
- **.NET 8 SDK** (if using WinUI GUI)
- **Windows 10/11** (for WinUI GUI or Windows print API)
### Installation
```bash
# Clone repository
git clone https://github.com/nsh1l/print-queue-app.git
cd print-queue-app
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
```
### Usage
#### GUI Mode (recommended - Windows)
```bash
# Use launcher (auto-starts WinUI server + Python client)
python run_app.py
# Or directly
python -m src --gui
```
#### Mock GUI Mode (Mac/Linux/dev)
```bash
# Use mock server (no Windows required)
python run_app.py --mock
```
#### CLI Mode
```bash
# Specify files from command line
python run_app.py --cli report.xlsx invoice.pdf
```
### Environment Variables
| Variable | Description | Default |
|------|------|-----------|
| `PRINT_QUEUE_MCP_URL` | MCP server URL | `http://localhost:8765` |
| `DOTNET_PATH` | dotnet CLI path | `dotnet` |
## MCP Tool Interface
The WinUI server exposes the following MCP tools:
| Tool | Description |
|--------|------|
| `winui_create_window` | Create main window |
| `winui_add_drop_zone` | Add file drop zone |
| `winui_update_file_list` | Update queue list |
| `winui_add_button` | Add toolbar button |
| `winui_add_label` | Add text label |
| `winui_set_status_text` | Update status bar |
| `winui_set_progress` | Update progress bar |
| `winui_poll_events` | Poll UI events |
### Transfer Protocol
- **Development/testing**: stdio (JSON-RPC over stdin/stdout)
- **Production**: HTTP POST `http://localhost:8765/mcp`
## Project Structure
```
print-queue-app/
├── run_app.py # App launcher
├── winui_mcp_server.py # WinUI MCP server (Python)
├── winui_bridge.py # WinUI bridge (Windows native)
├── requirements.txt # Python dependencies
├── src/
│ ├── __main__.py # Entry point
│ ├── main.py # Main application
│ ├── queue_item.py # Queue item definition
│ ├── file_processor.py # File processing
│ ├── print_engine.py # Print engine
│ ├── winui_client.py # WinUI client
│ └── mock_mcp_server.py # Mock MCP server
└── WinUIMCPServer/
├── Program.cs # C# entry point
├── MCPServer.cs # MCP server implementation
├── MainWindow.xaml.cs # Main window
└── PrintQueueApp.WinUI.csproj
```
## Development
### Testing
```bash
# Server unit test
python test_server.py
```
### Remote Connection
Refer to `CONNECTION.md` for remote server connection settings.
```bash
# Connect to remote server
python -m src --mock --url http://print.soichi.ro/ --token <token>
```
## Notes
- **WinUI GUI** requires Windows environment
- Use `--mock` or `--cli` mode on **Mac/Linux**
- Print functionality depends on Windows printer drivers
- Unix/Linux can use `lp` command for printing
## License
MIT License
## Contribution
Issues and Pull Requests are welcome!
## Support
Please report questions or issues on GitHub Issues.