mrjever commited on
Commit
1ad8bd4
·
verified ·
1 Parent(s): bbbf4c4

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +77 -0
main.py CHANGED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tkinter as tk
2
+ from pystray import Icon, Menu, MenuItem
3
+ from PIL import Image, ImageDraw
4
+ import threading
5
+ import pyautogui
6
+ import sys
7
+ import time
8
+
9
+ # --- LOGICA J.A.R.V.I.S. ---
10
+ def jarvis_brain():
11
+ """Aici rulează procesele de fundal ale lui Jarvis"""
12
+ print("J.A.R.V.I.S. este activat și monitorizează sistemul.")
13
+
14
+ # Simulare: În viitor, aici vei adăuga modelul Whisper pentru voce
15
+ # Pentru moment, l-am programat să fie gata de execuție.
16
+ while True:
17
+ # Aici va veni codul de ascultare
18
+ time.sleep(1)
19
+
20
+ def on_quit(icon, item):
21
+ """Închide complet aplicația din System Tray"""
22
+ icon.stop()
23
+ sys.exit()
24
+
25
+ def minimize_to_tray(window):
26
+ """Ascunde fereastra și creează iconița de lângă ceas"""
27
+ window.withdraw() # Ascunde fereastra principală
28
+
29
+ # Creăm o iconiță (un cerc albastru neon stil Stark)
30
+ width, height = 64, 64
31
+ image = Image.new('RGB', (width, height), color=(0, 0, 0))
32
+ dc = ImageDraw.Draw(image)
33
+ dc.ellipse((10, 10, 54, 54), fill=(0, 255, 255)) # Albastru deschis
34
+
35
+ # Pornim thread-ul pentru inteligența lui Jarvis
36
+ threading.Thread(target=jarvis_brain, daemon=True).start()
37
+
38
+ # Creăm meniul din System Tray
39
+ menu = Menu(
40
+ MenuItem("J.A.R.V.I.S. Online", lambda: None, enabled=False),
41
+ MenuItem("Închide Sistemul", on_quit)
42
+ )
43
+
44
+ icon = Icon("Jarvis", image, "J.A.R.V.I.S.", menu)
45
+ icon.run()
46
+
47
+ # --- INTERFAȚA DE PORNIRE (GUI) ---
48
+ def create_gui():
49
+ root = tk.Tk()
50
+ root.title("S.H.I.E.L.D. OS - J.A.R.V.I.S. Boot")
51
+ root.geometry("400x250")
52
+ root.configure(bg="#0a0a0a")
53
+
54
+ # Design minimalist stil Tony Stark
55
+ label = tk.Label(
56
+ root,
57
+ text="WELCOME BACK, SIR.\n\nSistemul este gata de inițializare.",
58
+ fg="#00ffff", bg="#0a0a0a", font=("Courier", 12, "bold"),
59
+ pady=30
60
+ )
61
+ label.pack()
62
+
63
+ btn_start = tk.Button(
64
+ root,
65
+ text="ACTIVEAZĂ J.A.R.V.I.S.",
66
+ command=lambda: minimize_to_tray(root),
67
+ bg="#00ffff", fg="black",
68
+ font=("Arial", 10, "bold"),
69
+ width=25, height=2,
70
+ relief="flat"
71
+ )
72
+ btn_start.pack(pady=10)
73
+
74
+ root.mainloop()
75
+
76
+ if __name__ == "__main__":
77
+ create_gui()