-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_page.py
More file actions
63 lines (54 loc) · 2.35 KB
/
system_page.py
File metadata and controls
63 lines (54 loc) · 2.35 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
import customtkinter as ctk
import threading
import time
from modules import system_boost, memory_cleaner, gpu_boost
def build_system_page(parent, app):
frame = ctk.CTkFrame(parent, fg_color="#02122f")
frame.pack(fill="both", expand=True, padx=20, pady=20)
progress_label = ctk.CTkLabel(frame, text=app.t("progress_status"), font=ctk.CTkFont(size=16, weight="bold"))
progress_label.pack(pady=(10,5))
progress_bar = ctk.CTkProgressBar(frame, width=450)
progress_bar.pack(pady=10)
boost_btn = ctk.CTkButton(frame, text=app.t("boost_button"), width=200)
boost_btn.pack(pady=10)
clean_btn = ctk.CTkButton(frame, text=app.t("memory_clean"), width=200)
clean_btn.pack(pady=10)
def smooth_progress(target):
current = progress_bar.get()
while abs(current - target) > 0.01:
current += (target - current) * 0.2
progress_bar.set(current)
time.sleep(0.02)
progress_bar.set(target)
def run_boost():
app.log(app.t("status_boosting"))
progress_bar.set(0.0)
steps = [
("Boost CPU", system_boost.boost_cpu),
("Set High Performance", system_boost.set_high_performance_power_plan),
("Optimize GPU", gpu_boost.optimize_gpu),
("Clean Temp Files", memory_cleaner.clean_temp),
("Finalize Boost", lambda: time.sleep(0.2))
]
for i, (desc, func) in enumerate(steps, start=1):
app.log(f"[BOOST] {desc}")
func()
smooth_progress(i / len(steps))
app.log(app.t("status_ready"))
progress_bar.set(0.0)
def run_clean():
app.log(app.t("status_cleaning"))
progress_bar.set(0.0)
steps = [
("Clean RAM", memory_cleaner.clean_ram),
("Clean Temp", memory_cleaner.clean_temp),
("Finalize Clean", lambda: time.sleep(0.2))
]
for i, (desc, func) in enumerate(steps, start=1):
app.log(f"[CLEAN] {desc}")
func()
smooth_progress(i / len(steps))
app.log(app.t("status_ready"))
progress_bar.set(0.0)
boost_btn.configure(command=lambda: threading.Thread(target=run_boost, daemon=True).start())
clean_btn.configure(command=lambda: threading.Thread(target=run_clean, daemon=True).start())