-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
68 lines (56 loc) · 1.81 KB
/
Copy pathmain.py
File metadata and controls
68 lines (56 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Hauptanwendung für das Datei-Sortierungsprogramm mit KI-Unterstützung (Ollama)
"""
import os
import tkinter as tk
from tkinter import ttk, messagebox
# Module importieren
try:
from config import load_config, save_config, CONFIG_FILE, DEFAULT_CONFIG
from gui import create_main_window
from util import check_dependencies
except ImportError as e:
# Fehlerbehandlung für fehlende Module
import sys
print(f"Fehler beim Importieren der Module: {e}")
print("Stellen Sie sicher, dass alle Dateien im selben Verzeichnis liegen.")
# GUI-Fehleranzeige, falls tkinter verfügbar ist
try:
import tkinter as tk
from tkinter import messagebox
root = tk.Tk()
root.withdraw()
messagebox.showerror(
"Fehler beim Starten",
f"Fehler beim Importieren der Module: {e}\n\n"
"Stellen Sie sicher, dass alle Dateien im selben Verzeichnis liegen."
)
except:
pass
sys.exit(1)
def main():
"""Haupteinstiegspunkt der Anwendung"""
# Abhängigkeiten prüfen
missing_deps = check_dependencies()
if missing_deps:
error_message = f"Fehlende Abhängigkeiten: {', '.join(missing_deps)}\n\n"
error_message += "Bitte installieren Sie diese mit:\n"
error_message += f"pip install {' '.join(missing_deps)}"
print(error_message)
try:
root = tk.Tk()
root.withdraw()
messagebox.showerror("Fehlende Abhängigkeiten", error_message)
except:
pass
return
# Konfiguration laden
config = load_config()
# GUI starten
root = tk.Tk()
create_main_window(root, config)
root.mainloop()
if __name__ == "__main__":
main()