| 686 | ##==> NOTIFY INTERFACE CLASS |
| 687 | #################################################### |
| 688 | class Notify(QMainWindow): |
| 689 | def __init__(self, text): |
| 690 | QMainWindow.__init__(self) |
| 691 | self.ui = SpectrumSecurityNotify() |
| 692 | self.ui.setupUi(self) |
| 693 | |
| 694 | ## ==> MAIN SETTINGS |
| 695 | ############################################################## |
| 696 | self.setWindowFlags(Qt.ToolTip) |
| 697 | self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.CustomizeWindowHint | Qt.WindowStaysOnTopHint) |
| 698 | self.setWindowFlag(QtCore.Qt.FramelessWindowHint) |
| 699 | self.setAttribute(QtCore.Qt.WA_TranslucentBackground, True) |
| 700 | |
| 701 | self.ui.notify_text.setText(text) |
| 702 | |
| 703 | ## ==> WINDOW BTNS |
| 704 | ############################################################## |
| 705 | self.ui.close_btn.clicked.connect(lambda: self.close_notify()) |
| 706 | |
| 707 | ## ==> MOVE TO BOTTOM RIGHT |
| 708 | ############################################################## |
| 709 | self.desktop = QGuiApplication.primaryScreen().availableGeometry() |
| 710 | self.start_animation() |
| 711 | |
| 712 | self.notify = QSound('data/notifications/notification.wav', self) |
| 713 | self.notify.play() |
| 714 | |
| 715 | self.show() |
| 716 | |
| 717 | def start_animation(self): |
| 718 | self.start_animation = QPropertyAnimation(self, b"geometry") |
| 719 | self.start_animation.setDuration(200) |
| 720 | self.start_animation.setStartValue(QRect(self.desktop.width() - 1, self.desktop.height() - 110, 1, 100)) |
| 721 | self.start_animation.setEndValue(QRect(self.desktop.width() - 410, self.desktop.height() - 110, 400, 100)) |
| 722 | self.start_animation.start() |
| 723 | QTimer.singleShot(5200, lambda: self.end_animation()) |
| 724 | |
| 725 | def end_animation(self): |
| 726 | self.end_animation = QPropertyAnimation(self, b"geometry") |
| 727 | self.end_animation.setDuration(200) |
| 728 | self.end_animation.setStartValue(QRect(self.desktop.width() - 410, self.desktop.height() - 110, 400, 100)) |
| 729 | self.end_animation.setEndValue(QRect(self.desktop.width() - 1, self.desktop.height() - 110, 1, 100)) |
| 730 | self.end_animation.start() |
| 731 | QTimer.singleShot(200, lambda: self.close_notify()) |
| 732 | |
| 733 | def close_notify(self): |
| 734 | self.close() |
| 735 | |
| 736 | |
| 737 | class SystemTrayIcon(QtWidgets.QSystemTrayIcon): |