Files
pdf_to_ics/start_gui.sh

73 lines
2.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# PDF zu ICS Konverter - GUI Startskript
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
# Finde Python-Executable
PYTHON_CMD=""
if command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
else
echo "❌ Fehler: Python nicht gefunden!"
echo "Bitte installieren Sie Python 3.6 oder höher."
exit 1
fi
echo "🐍 Nutze: $PYTHON_CMD"
# Erstelle venv wenn nicht vorhanden
if [ ! -d ".venv" ]; then
echo "📦 Python-Umgebung wird eingerichtet..."
$PYTHON_CMD -m venv .venv --upgrade-deps || {
echo "❌ venv konnte nicht erstellt werden"
exit 1
}
fi
# Nutze Python aus venv
PYTHON_VENV=".venv/bin/python"
# Überprüfe, ob Abhängigkeiten installiert sind
if ! $PYTHON_VENV -c "import pdfplumber" 2>/dev/null; then
echo "📚 Installiere Abhängigkeiten..."
if $PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging 2>/dev/null; then
echo "✓ Abhängigkeiten installiert"
else
echo "❌ Installation fehlgeschlagen"
echo "🔧 Versuche venv neu aufzubauen..."
rm -rf .venv
$PYTHON_CMD -m venv .venv --upgrade-deps || {
echo "❌ venv konnte nicht neu erstellt werden"
exit 1
}
$PYTHON_VENV -m pip install -q pdfplumber icalendar pypdf2 pytz packaging || {
echo "❌ Abhängigkeiten konnten nicht installiert werden"
exit 1
}
echo "✓ venv neu erstellt"
fi
fi
# Versuche tkinterdnd2 zu installieren (optional für Drag & Drop)
if ! $PYTHON_VENV -c "import tkinterdnd2" 2>/dev/null; then
echo "💡 Installiere tkinterdnd2 für Drag & Drop (optional)..."
$PYTHON_VENV -m pip install -q tkinterdnd2 2>/dev/null && echo "✓ Drag & Drop aktiviert" || echo " Drag & Drop nicht verfügbar (kein Problem)"
fi
# Starte die GUI
echo "🎨 Starte GUI..."
if [ -f "$PYTHON_VENV" ]; then
$PYTHON_VENV gui.py
else
echo "❌ Fehler: Python-Umgebung ist beschädigt"
echo "📁 Bitte löschen Sie das .venv Verzeichnis und versuchen Sie erneut:"
echo " rm -rf .venv"
echo " ./start_gui.sh"
exit 1
fi