Metadata-Version: 2.4
Name: comfyui-launcher
Version: 1.0.0
Summary: A modern GTK4 launcher for ComfyUI with conda environment support
Author: ComfyUI Launcher Team
Maintainer: ComfyUI Launcher Team
License: MIT
Project-URL: Homepage, https://github.com/your-username/comfyui-launcher
Project-URL: Repository, https://github.com/your-username/comfyui-launcher
Project-URL: Issues, https://github.com/your-username/comfyui-launcher/issues
Project-URL: Documentation, https://github.com/your-username/comfyui-launcher/blob/main/README_EN.md
Keywords: comfyui,launcher,gtk4,conda,ai,stable-diffusion
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Environment :: X11 Applications :: GTK
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyGObject>=3.42.0
Provides-Extra: monitoring
Requires-Dist: psutil>=5.9.0; extra == "monitoring"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# ComfyUI Launcher

A modern GTK4 launcher for ComfyUI with full conda environment support.

![GTK4](https://img.shields.io/badge/GTK-4.0-blue)
![Python](https://img.shields.io/badge/Python-3.9+-green)
![License](https://img.shields.io/badge/License-MIT-yellow)

## Features

- 🚀 **Conda Environment Management**: Easy selection of available conda environments
- 🔧 **Automatic Installation**: Install ComfyUI and comfy-cli with one click
- 📊 **Real-time Monitoring**: Continuously monitors if ComfyUI is running
- 🎮 **Intuitive Controls**: Start and stop ComfyUI easily
- 📝 **Real-time Logs**: View ComfyUI output directly in the launcher
- 🎨 **Modern Interface**: Built with GTK4 and libadwaita

## Prerequisites

- Python 3.9 or higher
- conda or miniconda installed
- GTK4 and libadwaita
- Development libraries (cairo-devel, gobject-introspection-devel, etc.)

## System Dependencies Installation

### Fedora/RHEL/CentOS/Rocky Linux

```bash
# Install system dependencies
sudo dnf install cairo-devel gobject-introspection-devel gtk4-devel pkg-config python3-devel

# Install conda if not already installed
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```

### Debian/Ubuntu

```bash
# Update package list
sudo apt update

# Install system dependencies
sudo apt install libcairo2-dev libgirepository1.0-dev libgtk-4-dev pkg-config python3-dev python3-venv

# Install conda if not already installed
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```

## Installation

1. **Clone the repository:**
```bash
git clone <repository-url>
cd gtk-app
```

2. **Create and activate virtual environment:**
```bash
python3 -m venv .venv
source .venv/bin/activate
```

3. **Install Python dependencies:**
```bash
pip install -r requirements.txt
```

## Usage

### Quick Start

1. **Launch the application:**
```bash
python main.py
```
or use the provided script:
```bash
./run.sh
```

2. **Select a conda environment** from the dropdown list

3. **Install ComfyUI** (if not already installed) by clicking "Install ComfyUI"

4. **Start ComfyUI** by clicking "Start ComfyUI"

5. The launcher will **automatically monitor** ComfyUI status

### Detailed Workflow

1. **Environment Selection**
   - The launcher automatically detects all available conda environments
   - Select your preferred environment from the dropdown
   - Click "Refresh Environment List" to reload environments

2. **ComfyUI Installation**
   - If ComfyUI is not installed in the selected environment, click "Install ComfyUI"
   - This will install both `comfy-cli` and ComfyUI automatically
   - Installation progress is shown in the log window

3. **Running ComfyUI**
   - Click "Start ComfyUI" to launch ComfyUI in the selected environment
   - Real-time output appears in the log window
   - The status indicator shows when ComfyUI is running

4. **Monitoring**
   - The launcher checks every 3 seconds if ComfyUI is running
   - Status is indicated by both text and visual indicators
   - Automatic detection works even if ComfyUI was started outside the launcher

## Features Detail

### Environment Management
- Automatic detection of all conda environments
- Support for conda base environment
- Refresh button to reload environment list
- Clear indication of selected environment

### Status Monitoring
- Checks every 3 seconds if ComfyUI is running
- Visual status indicator (icon and color)
- Detection via port 8188 and active processes
- Works even with externally started ComfyUI instances

### Controls
- **Start ComfyUI**: Launch ComfyUI in selected environment
- **Stop ComfyUI**: Gracefully terminate ComfyUI process
- **Install ComfyUI**: Install comfy-cli and ComfyUI in environment
- **Refresh Environments**: Reload conda environment list

### Logging
- Real-time output from ComfyUI
- Timestamp for each message
- Monospace font for better readability
- Automatic scrolling to latest messages

## File Structure

```
gtk-app/
├── main.py                    # Main application
├── requirements.txt           # Python dependencies
├── style.css                  # Custom styles (optional)
├── comfyui-launcher.desktop   # Desktop integration file
├── run.sh                     # Launch script
├── README.md                  # This file
├── .gitignore                 # Git ignore rules
└── .venv/                     # Virtual environment (created after setup)
```

## Troubleshooting

### Conda not found
Make sure conda is in your PATH:
```bash
export PATH="$HOME/miniconda3/bin:$PATH"
# Add to ~/.bashrc or ~/.zshrc for persistence
echo 'export PATH="$HOME/miniconda3/bin:$PATH"' >> ~/.bashrc
```

### Permission errors
Make the script executable:
```bash
chmod +x main.py
chmod +x run.sh
```

### ComfyUI won't start
- Verify the conda environment has Python 3.9+
- Check that comfy-cli is properly installed
- Review logs for specific error messages
- Ensure sufficient disk space and memory

### GTK/PyGObject errors
Make sure all system dependencies are installed:
```bash
# Fedora/RHEL
sudo dnf install gtk4-devel python3-gobject

# Debian/Ubuntu  
sudo apt install libgtk-4-dev python3-gi
```

### Missing fonts
The launcher uses monospace fonts for logs. If fonts appear wrong:
```bash
# Install additional fonts (optional)
sudo dnf install jetbrains-mono-fonts  # Fedora
sudo apt install fonts-jetbrains-mono  # Ubuntu
```

## Development

### Setting up development environment

1. Fork the repository
2. Clone your fork
3. Install development dependencies:
```bash
pip install -r requirements.txt
```
4. Make your changes
5. Test thoroughly
6. Submit a pull request

### Code Style
- Follow PEP 8 for Python code
- Use meaningful variable names
- Add comments for complex logic
- Keep functions focused and small

## Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Update documentation
6. Submit a pull request

## License

MIT License - see the LICENSE file for details.

## Acknowledgments

- [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - The amazing stable diffusion GUI
- [comfy-cli](https://github.com/Comfy-Org/comfy-cli) - Command line tool for ComfyUI
- [GTK](https://gtk.org/) - The GUI toolkit
- [PyGObject](https://pygobject.readthedocs.io/) - Python bindings for GTK

## Support

If you encounter issues:

1. Check the troubleshooting section above
2. Search existing GitHub issues
3. Create a new issue with:
   - Your operating system and version
   - Python version
   - Complete error messages
   - Steps to reproduce the problem
