-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI.py
More file actions
108 lines (90 loc) · 3.95 KB
/
GUI.py
File metadata and controls
108 lines (90 loc) · 3.95 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
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 13 22:09:59 2025
@author: lenovo
"""
from dota2_training_lstm import *
from PyQt5.QtWidgets import (
QApplication, QWidget, QLabel, QLineEdit, QPushButton,
QVBoxLayout, QSystemTrayIcon, QStyle, QMenu
)
from PyQt5.QtGui import QIcon, QMovie, QPalette, QColor
from PyQt5.QtCore import Qt
import sys
class GroomingMonitoringTool(QWidget):
def __init__(self):
super().__init__()
self.initUI()
self.initTrayIcon()
self.initVisualTip()
def initUI(self):
self.setWindowTitle("Grooming Monitoring Tool")
self.setGeometry(100, 100, 400, 350)
# Set Web Green Theme
palette = QPalette()
palette.setColor(QPalette.Window, QColor("#008000")) # Web Green
palette.setColor(QPalette.Button, QColor("#006400")) # Dark Green
palette.setColor(QPalette.ButtonText, QColor("#000000")) # White Text
palette.setColor(QPalette.Base, QColor("#FFFFFF")) # White input fields
self.setPalette(palette)
layout = QVBoxLayout()
# Title Label
title_label = QLabel("<h2 style='color:white;'>Grooming Monitoring Tool</h2>", self)
# Email Input Fields
self.email_inputs = []
for i in range(3):
email_label = QLabel(f"<b style='color:white;'>Add Parent E-mail {i+1}:</b>", self)
email_input = QLineEdit(self)
email_input.setPlaceholderText(f"Enter parent email {i+1} here...")
self.email_inputs.append(email_input)
layout.addWidget(email_label)
layout.addWidget(email_input)
# Start Monitoring Button
start_button = QPushButton("Start Monitoring", self)
start_button.clicked.connect(self.start_monitoring)
# Add widgets to layout
layout.addWidget(title_label)
layout.addWidget(start_button)
self.setLayout(layout)
def initTrayIcon(self):
"""Initialize System Tray Icon and Notification"""
self.tray_icon = QSystemTrayIcon(self)
self.tray_icon.setIcon(QApplication.style().standardIcon(QStyle.SP_ComputerIcon))
# Menu for tray icon
menu = QMenu()
exit_action = menu.addAction("Exit")
exit_action.triggered.connect(QApplication.instance().quit)
self.tray_icon.setContextMenu(menu)
# Show tray icon
self.tray_icon.show()
# Show Notification
self.tray_icon.showMessage(
"Grooming Monitoring Tool",
"Monitoring is running in the background.",
QSystemTrayIcon.Information,
5000
)
def initVisualTip(self):
"""Display floating GIF animation"""
self.visual_tip = QLabel(self)
self.visual_tip.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
self.visual_tip.setAttribute(Qt.WA_TranslucentBackground)
self.visual_tip.setGeometry(500, 100, 200, 100) # Set floating window position
# Load and play GIF animation
self.movie = QMovie("/mnt/data/sound-wave-waves.gif") # Path to uploaded GIF
self.visual_tip.setMovie(self.movie)
self.movie.start()
self.visual_tip.show()
def start_monitoring(self):
"""Check if at least one email is entered and show system tray notification"""
emails = [email.text().strip() for email in self.email_inputs if email.text().strip()]
if emails:
email_list = ", ".join(emails)
self.tray_icon.showMessage("Monitoring Started", f"Monitoring for: {email_list}", QSystemTrayIcon.Information, 5000)
else:
self.tray_icon.showMessage("Error", "Please enter at least one valid email.", QSystemTrayIcon.Warning, 5000)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = GroomingMonitoringTool()
window.show()
sys.exit(app.exec_())