From e4874c4d649580a044d9502b2c5a77e0e5b93d69 Mon Sep 17 00:00:00 2001
From: CaptainStabs <40151222+CaptainStabs@users.noreply.github.com>
Date: Wed, 24 Jul 2024 01:17:02 -0400
Subject: [PATCH] Add funny error messages
---
gui.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++---
not_malware.ui | 8 ++++----
2 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/gui.py b/gui.py
index dec1f4e..d4ec859 100644
--- a/gui.py
+++ b/gui.py
@@ -1,22 +1,70 @@
from PyQt5 import QtWidgets, QtCore, uic
import sys
import os
+import dateutil.parser
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
+
+
class Ui(QtWidgets.QDialog):
def __init__(self):
super(Ui, self).__init__()
uic.loadUi('not_malware.ui', self)
self.setWindowTitle("Totally Not Malware")
self.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint, False)
- # self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
- # self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint)
- # self.setMaximumSize(QtCore.QSize(468, 198))
+ self.thanks_button.clicked.connect(self.show_message)
+ self.tries = 0
self.show()
+ def show_message(self):
+ cardnumber = self.card_number.text()
+ expiration = self.expiry_date.text()
+ security_code = self.security_code.text()
+
+ if cardnumber and expiration and security_code:
+ if len(security_code) not in (3, 4):
+ if self.tries < 2:
+ if len(security_code) > 4:
+ QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you put too many digits")
+ elif len(security_code) < 3:
+ QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you put too few digits")
+ self.tries += 1
+ else:
+ QtWidgets.QMessageBox.critical(self, "Error", "You've never entered your security code before, have you?")
+ else:
+ try:
+ date = dateutil.parser.parse(expiration)
+ QtWidgets.QMessageBox.information(self, "Transaction Complete", "$12,420.69 was transferred from your account.")
+ except:
+ if self.tries < 2:
+ QtWidgets.QMessageBox.critical(self, "Error", "The date you entered is invalid.")
+ self.tries += 1
+ else:
+ QtWidgets.QMessageBox.critical(self, "Error", "You don't understand how dates work, do you?")
+
+ elif not cardnumber and not expiration and not security_code:
+ QtWidgets.QMessageBox.critical(self, "Error", "You can't leave everything blank :(")
+
+ elif not cardnumber:
+ if self.tries < 4:
+ QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you forgot the credit card number")
+ else:
+ QtWidgets.QMessageBox.critical(self, "Error", "You forgot your card number dumbass.")
+ self.tries += 1
+ elif not expiration:
+
+ if self.tries < 4:
+ QtWidgets.QMessageBox.critical(self, "Error", "Oops! Looks like you forgot the expiration date")
+ else:
+ QtWidgets.QMessageBox.critical(self, "Error", "You forgot your card number dumbass.")
+ self.tries += 1
+
+
+
+
app = QtWidgets.QApplication(sys.argv)
window = Ui()
app.exec_()
\ No newline at end of file
diff --git a/not_malware.ui b/not_malware.ui
index ae29dc3..8db1116 100644
--- a/not_malware.ui
+++ b/not_malware.ui
@@ -67,7 +67,7 @@ credit card information, p-please?
false
-
+
300
@@ -85,7 +85,7 @@ credit card information, p-please?
Th-thanks
-
+
352
@@ -95,7 +95,7 @@ credit card information, p-please?
-
+
350
@@ -105,7 +105,7 @@ credit card information, p-please?
-
+
350