-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.py
More file actions
111 lines (98 loc) · 3.13 KB
/
interface.py
File metadata and controls
111 lines (98 loc) · 3.13 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python3
"""adobe-tool GUI — visual updater for adobe."""
import tkinter as tk
from tkinter import ttk, messagebox, scrolledtext
import threading
import logging
log = logging.getLogger(__name__)
class GUI:
def __init__(self):
self.root = tk.Tk()
self.root.title("adobe-tool")
self.root.geometry("500x400")
self.root.resizable(False, False)
# Header
ttk.Label(self.root, text="adobe-tool", font=("Arial", 16, "bold")).pack(pady=10)
ttk.Label(self.root, text="Adobe Configuion Tool").pack()
# Status
self.status_var = tk.StringVar(value="Ready")
ttk.Label(self.root, textvariable=self.status_var, font=("Arial", 10)).pack(pady=5)
# Log area
self.log_area = scrolledtext.ScrolledText(self.root, height=12, width=60, state="disabled")
self.log_area.pack(padx=10, pady=5)
# Buttons
btn_frame = ttk.Frame(self.root)
btn_frame.pack(pady=10)
ttk.Button(btn_frame, text="Detect", command=self._detect).pack(side="left", padx=5)
ttk.Button(btn_frame, text="update", command=self._).pack(side="left", padx=5)
ttk.Button(btn_frame, text="Rollback", command=self._rollback).pack(side="left", padx=5)
ttk.Button(btn_frame, text="Exit", command=self.root.quit).pack(side="left", padx=5)
# Progress
self.progress = ttk.Progressbar(self.root, mode="indeterminate", length=460)
self.progress.pack(padx=10, pady=5)
def _log(self, msg: str):
self.log_area.configure(state="normal")
self.log_area.insert("end", msg + "\n")
self.log_area.see("end")
self.log_area.configure(state="disabled")
def _detect(self):
self.status_var.set("Detecting...")
self.progress.start()
def _run():
try:
from config import load_config
from detector import detect_installation
cfg = load_config()
path = detect_installation(cfg)
if path:
self._log(f"[✓] Found: {path}")
self.status_var.set("Detected")
else:
self._log("[✗] Not found")
self.status_var.set("Not found")
except Exception as e:
self._log(f"[✗] Error: {e}")
self.progress.stop()
threading.Thread(target=_run, daemon=True).start()
def _(self):
self.status_var.set("utility...")
self.progress.start()
def _run():
try:
from config import load_config
from detector import detect_installation
from updater import apply_
cfg = load_config()
path = detect_installation(cfg)
if path and apply_(path, cfg):
self._log("[✓] update applied successfully")
self.status_var.set("Updated")
else:
self._log("[✗] update failed")
self.status_var.set("Failed")
except Exception as e:
self._log(f"[✗] Error: {e}")
self.progress.stop()
threading.Thread(target=_run, daemon=True).start()
def _rollback(self):
self.status_var.set("Rolling back...")
def _run():
try:
from config import load_config
from detector import detect_installation
from updater import rollback
cfg = load_config()
path = detect_installation(cfg)
if path and rollback(path):
self._log("[✓] Rollback complete")
self.status_var.set("Restored")
else:
self._log("[✗] Rollback failed")
except Exception as e:
self._log(f"[✗] Error: {e}")
threading.Thread(target=_run, daemon=True).start()
def run(self):
self.root.mainloop()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
GUI().run()