-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank project.py
1130 lines (1003 loc) · 52.3 KB
/
Bank project.py
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
________ ________ ________ ___ __ ________ ________ ________ ___ _______ ________ _________
|\ __ \|\ __ \|\ ___ \|\ \|\ \ |\ __ \|\ __ \|\ __ \ |\ \|\ ___ \ |\ ____\\___ ___\
\ \ \|\ /\ \ \|\ \ \ \\ \ \ \ \/ /|_ \ \ \|\ \ \ \|\ \ \ \|\ \ \ \ \ \ __/|\ \ \___\|___ \ \_|
\ \ __ \ \ __ \ \ \\ \ \ \ ___ \ \ \ ____\ \ _ _\ \ \\\ \ __ \ \ \ \ \_|/_\ \ \ \ \ \
\ \ \|\ \ \ \ \ \ \ \\ \ \ \ \\ \ \ \ \ \___|\ \ \\ \\ \ \\\ \|\ \\_\ \ \ \_|\ \ \ \____ \ \ \
\ \_______\ \__\ \__\ \__\\ \__\ \__\\ \__\ \ \__\ \ \__\\ _\\ \_______\ \________\ \_______\ \_______\ \ \__\
\|_______|\|__|\|__|\|__| \|__|\|__| \|__| \|__| \|__|\|__|\|_______|\|________|\|_______|\|_______| \|__|
By Rasphy: https://github.com/Rasphy2009/Bank-Project
V 4.2
"""
# For encrypt/ decrypt
import base64
def encrypt(variable):
global encrypted
encrypted = variable.encode("utf-8")
return encrypted
# Sys for opening windows
import sys
# Import PySide6
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6.QtUiTools import QUiLoader
from PySide6.QtGui import QCloseEvent, QGuiApplication, QIcon, QPixmap
# Os for path
import os
# Re to check the special characters
import re
# Datetime for the date
from datetime import datetime
from datetime import date
# Time for time
import time
# Path
filePath = os.path.dirname(os.path.realpath(__file__))
path1 = filePath.replace("\\","/")
# To be able to import .ui and define app
loader = QUiLoader()
app = QtWidgets.QApplication(sys.argv)
# StyleSheet for buttons
btnStyleSheet = """QPushButton{\ntext-align: left;\npadding-left: 11px;\nbackground-color: fondo;\nborder-radius: 5px;\n}\nQPushButton::hover{\nbackground-color: rgb(199, 199, 205);\n}\nQPushButton::pressed{\nbackground-color: rgb(185, 185, 185);\n}"""
def clearLineEdits():
# Log in
logInWindow.lineEditUser.setText("")
logInWindow.lineEditPassword.setText("")
logInWindow.lineEditUser2.setText("")
logInWindow.lineEditPassword2.setText("")
logInWindow.lineEditVerifyPassword.setText("")
# Deposit money
mainWindow.lineEdit_2.setText("")
# Take out money
mainWindow.lineEdit_3.setText("")
# Change password
mainWindow.lineEditActualPassword.setText("")
mainWindow.lineEditNewPassword.setText("")
mainWindow.lineEditRepeatPassword.setText("")
# Transfer
mainWindow.lineEdit_6.setText("")
mainWindow.lineEdit_7.setText("")
# Change username
mainWindow.lineEditUsername.setText("")
def clearErrors():
# Log in
logInWindow.labelUserError2.hide()
logInWindow.labelPasswordError4.hide()
logInWindow.labelUserError.hide()
logInWindow.labelPasswordError2.hide()
logInWindow.correct.hide()
logInWindow.labelPasswordError2_2.hide()
logInWindow.labelPasswordError.hide()
# Deposit money
mainWindow.moneyError.hide()
mainWindow.lettersError.hide()
# Take out money
mainWindow.moneyError_2.hide()
mainWindow.moneyError_3.hide()
# Change password
mainWindow.passwordError.hide()
mainWindow.passwordError4.hide()
# Trasnfer
mainWindow.moneyError_5.hide()
mainWindow.letterError_5.hide()
mainWindow.nameError.hide()
# Change username
mainWindow.labelUserError.hide()
# Update window money values
def updateMoney():
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = bytes.decode(base64.b64decode(openMoneyRead.read()))
openMoneyRead.close()
mainWindow.labelMoney.setText(str(money)+" €")
mainWindow.labelMoney_2.setText(str(money)+" €")
mainWindow.labelMoney_3.setText(str(money)+" €")
mainWindow.labelMoney_4.setText(str(money)+" €")
mainWindow.labelMoney_5.setText(str(money)+" €")
# Splash screen
def splashScreen():
# Remove title bar
splashScreenWindow.setWindowFlag(QtCore.Qt.FramelessWindowHint)
splashScreenWindow.setAttribute(QtCore.Qt.WA_TranslucentBackground)
# Logo
splashScreenWindow.label.setPixmap(QtGui.QPixmap(path1+"/UIs/Imgs/logo.png"))
splashScreenWindow.label_2.setPixmap(QtGui.QPixmap(path1+"/UIs/Imgs/background.png"))
splashScreenWindow.label.setScaledContents(True)
# Open window
splashScreenWindow.show()
# Progress
for percentage in range(1, 35):
time.sleep(0.003)
splashScreenWindow.labelLoading.setText("Starting components...")
QGuiApplication.processEvents()
if percentage == 99:
splashScreenWindow.close()
logIn()
break
for percentage in range(35, 75):
time.sleep(0.005)
splashScreenWindow.labelLoading.setText("Loading interfaces...")
QGuiApplication.processEvents()
if percentage == 99:
splashScreenWindow.close()
logIn()
break
for percentage in range(75, 100, 2):
time.sleep(0.002)
splashScreenWindow.labelLoading.setText("Starting...")
QGuiApplication.processEvents()
if percentage == 99:
splashScreenWindow.close()
logIn()
break
# Log in and create account
def logIn():
# Remove title bar, maximize and resizing
logInWindow.setWindowFlag(QtCore.Qt.WindowMaximizeButtonHint, False)
logInWindow.logo.setPixmap(QPixmap(path1+"/UIs/Imgs/logo4.png"))
logInWindow.setFixedSize(logInWindow.width(), logInWindow.height())
logInWindow.show()
clearErrors()
# Checks if checkBox is clicked
def checkBox1Checker():
checkBoxValue = logInWindow.checkBox_password.checkState()
if str(checkBoxValue) == "PySide6.QtCore.Qt.CheckState.Checked":
logInWindow.lineEditPassword.setEchoMode(QtWidgets.QLineEdit.Normal)
else:
logInWindow.lineEditPassword.setEchoMode(QtWidgets.QLineEdit.Password)
def checkBox2Checker():
checkBoxValue = logInWindow.checkBox_Password2.checkState()
if str(checkBoxValue) == "PySide6.QtCore.Qt.CheckState.Checked":
logInWindow.lineEditPassword2.setEchoMode(QtWidgets.QLineEdit.Normal)
logInWindow.lineEditVerifyPassword.setEchoMode(QtWidgets.QLineEdit.Normal)
else:
logInWindow.lineEditPassword2.setEchoMode(QtWidgets.QLineEdit.Password)
logInWindow.lineEditVerifyPassword.setEchoMode(QtWidgets.QLineEdit.Password)
# Animation
def unfadeAnimation(window1, window2):
window1.hide()
window2.show()
# Unfade
logInWindow.effect = QtWidgets.QGraphicsOpacityEffect()
window2.setGraphicsEffect(logInWindow.effect)
logInWindow.animation = QtCore.QPropertyAnimation(logInWindow.effect, b"opacity")
logInWindow.animation.setDuration(500)
logInWindow.animation.setStartValue(0)
logInWindow.animation.setEndValue(1)
logInWindow.animation.start()
# Create an account
def createAccountScript():
createUser = logInWindow.lineEditUser2.text()
# Check if the user alredy exists
if os.path.isfile(path1+"/Data/Users/user_{}.txt".format(createUser)) == True:
logInWindow.labelUserError.show()
error = 1
return error
else:
pass
# Checks if createUser contains special characters and password
checkCharacters = re.compile('[@_!#$%^&*()<>?/\|}{~:]')
if (checkCharacters.search(createUser) == None):
passwordData = open(path1+"/Data/Passwords/password_{}.txt".format(createUser),"w")
createPassword = logInWindow.lineEditPassword2.text()
verifyPassword = logInWindow.lineEditVerifyPassword.text()
if createPassword == "" and verifyPassword == "":
logInWindow.labelPasswordError2.show()
passwordData.close()
error = 1
return error
else:
if createPassword == verifyPassword:
passwordData.write(bytes.decode(base64.b64encode(encrypt(createPassword))))
usernameData = open(path1+"/Data/Users/user_{}.txt".format(createUser),"w")
usernameData.write(createUser)
usernameData.close()
money = open(path1+"/Data/user_money/money_{}.txt".format(createUser),"w")
money.write(bytes.decode(base64.b64encode(encrypt("0"))))
money.close()
openHistory = open(path1+"/Data/History/history_{}.txt".format(createUser),"w")
openHistory.close()
passwordData.close()
logInWindow.lineEditUser2.setText("")
logInWindow.lineEditPassword2.setText("")
logInWindow.lineEditVerifyPassword.setText("")
logInWindow.correct.show()
else:
logInWindow.labelPasswordError.show()
passwordData.close()
error = 1
return error
else:
logInWindow.labelPasswordError2.show()
error = 1
return error
# Log in
def logInScript():
# Check if the user exists
correctAccount = False
askUser = logInWindow.lineEditUser.text()
try:
UserName = open(path1+"/Data/Users/user_{}.txt".format(askUser),"r")
global username
correctAccount = True
username = UserName.read()
UserName.close()
except FileNotFoundError:
logInWindow.labelUserError2.show()
error = 1
return error
# Check password
if correctAccount == True:
askPassword = logInWindow.lineEditPassword.text()
passwordData = open(path1+"/Data/Passwords/password_{}.txt".format(username),"r")
contraseña = bytes.decode(base64.b64decode(passwordData.read()))
passwordData.close()
if askPassword == contraseña:
logInWindow.close()
yourAccount()
else:
logInWindow.labelPasswordError4.show()
error = 1
return error
else:
logInWindow.labelUserError2.show()
error = 1
return error
# Main window
# Side bar animation
def clickButtonExpand(mainWindow):
menuWidth = mainWindow.sidebar.width()
# Check
width = 50
if menuWidth == 50:
width = 190
# Start animation
mainWindow.animExp = QtCore.QPropertyAnimation(mainWindow.sidebar, b"minimumWidth")
mainWindow.animExp.setDuration(300)
mainWindow.animExp.setStartValue(menuWidth)
mainWindow.animExp.setEndValue(width)
mainWindow.animExp.setEasingCurve(QtCore.QEasingCurve.InOutCirc)
mainWindow.animExp.start()
# Fade unfade animation
def fadeUnfadeAnimation(option):
# Show
mainWindow.stackedWidget.setCurrentWidget(option)
# Unfade
mainWindow.effect = QtWidgets.QGraphicsOpacityEffect()
option.setGraphicsEffect(mainWindow.effect)
mainWindow.animYourAccount = QtCore.QPropertyAnimation(mainWindow.effect, b"opacity")
mainWindow.animYourAccount.setDuration(300)
mainWindow.animYourAccount.setStartValue(0)
mainWindow.animYourAccount.setEndValue(1)
mainWindow.animYourAccount.start()
# Checks if checkBox is clicked in mainWindow
def checkBox3Checker():
checkBoxValue = mainWindow.checkBox_Password.checkState()
if str(checkBoxValue) == "PySide6.QtCore.Qt.CheckState.Checked":
mainWindow.lineEditActualPassword.setEchoMode(QtWidgets.QLineEdit.Normal)
mainWindow.lineEditNewPassword.setEchoMode(QtWidgets.QLineEdit.Normal)
mainWindow.lineEditRepeatPassword.setEchoMode(QtWidgets.QLineEdit.Normal)
else:
mainWindow.lineEditActualPassword.setEchoMode(QtWidgets.QLineEdit.Password)
mainWindow.lineEditNewPassword.setEchoMode(QtWidgets.QLineEdit.Password)
mainWindow.lineEditRepeatPassword.setEchoMode(QtWidgets.QLineEdit.Password)
# Checks if checkBox is clicked in dark mode settings
def checkBox4Checker():
checkBoxValue = mainWindow.checkBox_DarkMode.checkState()
if str(checkBoxValue) == "PySide6.QtCore.Qt.CheckState.Checked":
darkMode()
else:
lightMode()
# Your account window (mainWindow)
def yourAccount():
global money
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = bytes.decode(base64.b64decode(openMoneyRead.read()))
int(money)
openMoneyRead.close()
updateMoney()
mainWindow.labelUsername.setText("<strong>"+username+"</strong>")
mainWindow.show()
fadeUnfadeAnimation(mainWindow.yourAccount)
# Deposit money
def depositMoney():
updateMoney()
fadeUnfadeAnimation(mainWindow.depositMoney)
clearErrors()
def depositMoneyScript(depositMoney):
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
money = money + int(depositMoney)
history("Entered {} €".format(depositMoney))
openMoneyWrite = open(path1+"/data/user_money/money_{}.txt".format(username),"w")
openMoneyWrite.write(bytes.decode(base64.b64encode(encrypt(str(money)))))
openMoneyWrite.close()
updateMoney()
fadeUnfadeAnimation(mainWindow.correct)
clearLineEdits()
def depositMoneyCustomScript():
askDepositMoney = mainWindow.lineEdit_2.text()
if askDepositMoney.isnumeric():
if int(askDepositMoney) <= 1000000000:
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
money = money + int(askDepositMoney)
mainWindow.lineEdit_2.setText("")
openMoneyWrite = open(path1+"/Data/user_money/money_{}.txt".format(username),"w")
openMoneyWrite.write(bytes.decode(base64.b64encode(encrypt(str(money)))))
history("Entered {} €".format(money))
openMoneyWrite.close()
updateMoney()
fadeUnfadeAnimation(mainWindow.correct)
clearLineEdits()
else:
mainWindow.moneyError.show()
error = 1
return error
else:
mainWindow.lettersError.show()
error = 1
return error
# Take out money
def takeOutMoney():
updateMoney()
fadeUnfadeAnimation(mainWindow.takeOut)
clearErrors()
# Checks if there's enough money and more
def moneyChecker(checkMoney):
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
if checkMoney <= money:
money = money - int(checkMoney)
history("Withdrawn {} €".format(checkMoney))
openTakeOutMoney = open(path1+"/Data/user_money/money_{}.txt".format(username),"w")
openTakeOutMoney.write(bytes.decode(base64.b64encode(encrypt(str(money)))))
openTakeOutMoney.close()
updateMoney()
fadeUnfadeAnimation(mainWindow.correct)
clearLineEdits()
else:
fadeUnfadeAnimation(mainWindow.error)
mainWindow.title.setText("There isn't enough money")
mainWindow.filling.setText("There isn't enough money. Do you want to deposit some?")
error = 1
return error
def moneyCheckerCustom():
askTakeOutMoney = mainWindow.lineEdit_3.text()
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
if askTakeOutMoney.isnumeric():
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
if int(askTakeOutMoney) <= money:
money = money - int(askTakeOutMoney)
fadeUnfadeAnimation(mainWindow.correct)
history("Withdrawn {} €".format(askTakeOutMoney))
openMoneyTakeOut = open(path1+"/Data/user_money/money_{}.txt".format(username),"w")
openMoneyTakeOut.write(bytes.decode(base64.b64encode(encrypt(str(money)))))
openMoneyTakeOut.close()
updateMoney()
mainWindow.lineEdit_3.setText("")
clearLineEdits()
else:
mainWindow.moneyError_2.show()
error = 1
return error
else:
mainWindow.moneyError_3.show()
error = 1
return error
# History
# Show history window
def showHistory():
openHistory = open(path1+"/Data/History/history_{}.txt".format(username),"r+")
historyText = openHistory.read()
openHistory.close
mainWindow.textEdit.setText(historyText)
fadeUnfadeAnimation(mainWindow.history)
# Writes in the history file
def history(action):
openHistory = open(path1+"/Data/History/history_{}.txt".format(username),"a")
now = datetime.now()
hour = str(now.hour)
minute = str(now.minute)
date1 = str(date.today())+" "+hour+":"+minute
openHistory.write(""+date1+" "+action+"\n")
openHistory.close()
openHistory = open(path1+"/Data/History/history_{}.txt".format(username),"r")
lines = openHistory.readlines()
openHistory.close()
numberLines = len(lines)
if numberLines > 100:
with open(path1+"/Data/History/history_{}.txt".format(username),'r') as fin:
data = fin.read().splitlines(True)
with open(path1+"/Data/History/history_{}.txt".format(username),'w') as fout:
fout.writelines(data[1:])
else:
pass
# Change password
def cambiarContraseña():
fadeUnfadeAnimation(mainWindow.changePassword)
clearErrors()
def changePasswordScript():
actualPassword = mainWindow.lineEditActualPassword.text()
passwordData = open(path1+"/Data/Passwords/password_{}.txt".format(username),"r")
password = bytes.decode(base64.b64decode(passwordData.read()))
passwordData.close()
verifyPassword = mainWindow.lineEditRepeatPassword.text()
newPassword = mainWindow.lineEditNewPassword.text()
if actualPassword == password:
if verifyPassword == newPassword:
askChangePassword = mainWindow.lineEditNewPassword.text()
passwordData = open(path1+"/Data/Passwords/password_{}.txt".format(username),"w")
passwordData.write(bytes.decode(base64.b64encode(encrypt(askChangePassword))))
passwordData.close()
history("The password was changed")
fadeUnfadeAnimation(mainWindow.correct)
else:
mainWindow.passwordError.show()
error = 1
return error
else:
mainWindow.passwordError4.show()
error = 1
return error
# Transfer money
def transferMoneyScript(transferMoney):
correctAccount = False
global askAccountTransfer
askAccountTransfer = mainWindow.lineEdit_7.text()
try:
UserName = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"r")
correctAccount = True
UserName.close()
except FileNotFoundError:
mainWindow.nameError.setText("Can't find that account")
correctAccount = False
if askAccountTransfer == username:
mainWindow.nameError.setText("Why do you want to transfer yourself?")
else:
if correctAccount == True:
mainWindow.lineEdit_7.setText("")
openHistory2 = open(path1+"/Data/History/history_{}.txt".format(askAccountTransfer),"a")
openHistory2.close()
updateMoney()
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
openMoneyTransferGive = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
openMoneyTransferReceive = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"r")
moneyGive = int(bytes.decode(base64.b64decode(openMoneyTransferGive.read())))
moneyReceive = int(bytes.decode(base64.b64decode(openMoneyTransferReceive.read())))
openMoneyTransferGive.close()
openMoneyTransferReceive.close()
if transferMoney <= moneyGive:
moneyGive = moneyGive - transferMoney
moneyReceive = moneyReceive + transferMoney
openMoneyTransferGiveWrite = open(path1+"/Data/user_money/money_{}.txt".format(username),"w")
openMoneyTransferReceiveWrite = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"w")
historyOpenYou = open(path1+"/Data/History/history_{}.txt".format(username),"a")
historyOpenOther = open(path1+"/Data/History/history_{}.txt".format(askAccountTransfer),"a")
now = datetime.now()
hour = str(now.hour)
minute = str(now.minute)
date1 = str(date.today())+" "+hour+":"+minute
historyOpenYou.write(date1+" You have transferred "+str(transferMoney)+" € to "+askAccountTransfer+"\n")
historyOpenOther.write(date1+" "+username+" has transferred "+str(transferMoney)+ "€ to you."+"\n")
historyOpenYou.close()
historyOpenOther.close()
openHistory = open(path1+"/Data/History/history_{}.txt".format(username),"r")
lines = openHistory.readlines()
openHistory.close()
numberLines = len(lines)
if numberLines > 100:
with open(path1+"/Data/History/history_{}.txt".format(username), 'r') as fin:
data = fin.read().splitlines(True)
with open(path1+"/Data/History/history_{}.txt".format(username), 'w') as fout:
fout.writelines(data[1:])
else:
pass
openMoneyTransferGiveWrite.write(bytes.decode(base64.b64encode(encrypt(str(moneyGive)))))
openMoneyTransferReceiveWrite.write(bytes.decode(base64.b64encode(encrypt(str(moneyReceive)))))
openMoneyTransferGiveWrite.close()
openMoneyTransferReceiveWrite.close()
updateMoney()
mainWindow.lineEdit_6.setText("")
fadeUnfadeAnimation(mainWindow.correct)
clearLineEdits()
else:
mainWindow.nameError.setText("There isn't enough money :(")
mainWindow.nameError.show()
error = 1
return error
else:
mainWindow.nameError.setText("Can't find that account")
mainWindow.nameError.show()
error = 1
return error
def transferMoneyCustomScript():
correctAccount = False
global askAccountTransfer
askAccountTransfer = mainWindow.lineEdit_7.text()
try:
UserName = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"r")
correctAccount = True
UserName.close()
except FileNotFoundError:
mainWindow.nameError.setText("Can't find that account")
correctAccount = False
if askAccountTransfer == username:
mainWindow.nameError.setText("Why do you want to transfer yourself?")
else:
if correctAccount == True:
mainWindow.lineEdit_7.setText("")
openHistory2 = open(path1+"/Data/History/history_{}.txt".format(askAccountTransfer),"a")
openHistory2.close()
updateMoney()
else:
mainWindow.nameError.setText("Can't find that account")
error = 1
return error
openMoneyRead = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
money = int(bytes.decode(base64.b64decode(openMoneyRead.read())))
openMoneyRead.close()
askMoneyTransfer = mainWindow.lineEdit_6.text()
if askMoneyTransfer.isnumeric():
openMoneyTransferGive = open(path1+"/Data/user_money/money_{}.txt".format(username),"r")
openMoneyTransferReceive = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"r")
moneyGive = int(bytes.decode(base64.b64decode(openMoneyTransferGive.read())))
moneyReceive = int(bytes.decode(base64.b64decode(openMoneyTransferReceive.read())))
openMoneyTransferGive.close()
openMoneyTransferReceive.close()
if int(askMoneyTransfer) <= moneyGive:
moneyGive = moneyGive - int(askMoneyTransfer)
moneyReceive = moneyReceive + int(askMoneyTransfer)
openMoneyTransferGiveWrite = open(path1+"/Data/user_money/money_{}.txt".format(username),"w")
openMoneyTransferReceiveWrite = open(path1+"/Data/user_money/money_{}.txt".format(askAccountTransfer),"w")
openHistoryYou = open(path1+"/Data/History/history_{}.txt".format(username),"a")
openHistoryOther = open(path1+"/Data/History/history_{}.txt".format(askAccountTransfer),"a")
now = datetime.now()
hour = str(now.hour)
minute = str(now.minute)
date1 = str(date.today())+" "+hour+":"+minute
openHistoryYou.write(date1+" You have transferred "+str(askMoneyTransfer)+" € a "+askAccountTransfer+"\n")
openHistoryOther.write(date1+" "+username+" has transferred you "+str(askMoneyTransfer)+ "€"+"\n")
openHistoryYou.close()
openHistoryOther.close()
openHistory = open(path1+"/Data/History/history_{}.txt".format(username),"r")
lines = openHistory.readlines()
openHistory.close()
numberLines = len(lines)
if numberLines > 100:
with open(path1+"/Data/History/history_{}.txt".format(username), 'r') as fin:
data = fin.read().splitlines(True)
with open(path1+"/Data/History/history_{}.txt".format(username), 'w') as fout:
fout.writelines(data[1:])
else:
pass
openMoneyTransferGiveWrite.write(bytes.decode(base64.b64encode(encrypt(str(moneyGive)))))
openMoneyTransferReceiveWrite.write(bytes.decode(base64.b64encode(encrypt(str(moneyReceive)))))
openMoneyTransferGiveWrite.close()
openMoneyTransferReceiveWrite.close()
updateMoney()
mainWindow.lineEdit_6.setText("")
fadeUnfadeAnimation(mainWindow.correct)
else:
mainWindow.nameError.setText("Can't find that account")
mainWindow.nameError.show()
error = 1
return error
else:
mainWindow.nameError.setText("You can't transfer letters")
mainWindow.nameError.show()
error = 1
return error
def transferMoney():
mainWindow.nameError.setText("")
clearErrors()
fadeUnfadeAnimation(mainWindow.transfer)
# Log out
def logOut():
mainWindow.close()
logInWindow.show()
# Delete account
def deleteAccount():
os.remove(path1+"/Data/Users/user_{}.txt".format(username))
os.remove(path1+"/Data/Passwords/password_{}.txt".format(username))
os.remove(path1+"/Data/user_money/money_{}.txt".format(username))
os.remove(path1+"/Data/History/history_{}.txt".format(username))
mainWindow.close()
logInWindow.show()
# Change username
def changeUsername():
newUsername = mainWindow.lineEditUsername.text()
# User files
# Check if user alredy exists
if os.path.isfile(path1+"/Data/Users/user_{}.txt".format(newUsername)) == True:
mainWindow.labelUserError.show()
error = 1
return error
else:
pass
if newUsername == "":
mainWindow.labelUserError.setText("Your username can not be empty")
error = 1
return error
else:
lastName = username
usernameData = open(path1+"/Data/Users/user_{}.txt".format(newUsername),"w")
usernameData.write(newUsername)
usernameData.close()
# Money files
openMoneyFile = open(path1+"/Data/user_money/money_{}.txt".format(lastName),"r")
money = int(bytes.decode(base64.b64decode(openMoneyFile.read())))
openMoneyFile.close()
openMoneyFileNew = open(path1+"/Data/user_money/money_{}.txt".format(newUsername),"w")
openMoneyFileNew.write(bytes.decode(base64.b64encode(encrypt(str(money)))))
openMoneyFileNew.close()
# History
historyFile = open(path1+"/Data/History/history_{}.txt".format(lastName),"r+")
historyText = historyFile.read()
historyFile.close()
historyFileNew = open(path1+"/Data/History/history_{}.txt".format(newUsername),"w+")
historyFileNew.write(historyText)
historyFileNew.close()
# Password
passwordData = open(path1+"/Data/Passwords/password_{}.txt".format(lastName),"r+")
actualPassword = bytes.decode(base64.b64decode(passwordData.read()))
passwordData.close()
newPassword = open(path1+"/Data/Passwords/password_{}.txt".format(newUsername),"w+")
newPassword.write(bytes.decode(base64.b64encode(encrypt(actualPassword))))
newPassword.close()
os.remove(path1+"/Data/Users/user_{}.txt".format(lastName))
os.remove(path1+"/Data/Passwords/password_{}.txt".format(lastName))
os.remove(path1+"/Data/user_money/money_{}.txt".format(lastName))
os.remove(path1+"/Data/History/history_{}.txt".format(lastName))
fadeUnfadeAnimation(mainWindow.yourAccount)
openMoneyFileRead = open(path1+"/Data/user_money/money_{}.txt".format(newUsername),"r")
money = int(bytes.decode(base64.b64decode(openMoneyFileRead.read())))
openMoneyFileRead.close()
fadeUnfadeAnimation(mainWindow.ensureChangeUsername)
def darkMode():
# Change settings
openDarkMode = open(path1+"/Data/darkMode.txt","w")
openDarkMode.write("1")
openDarkMode.close()
# Log in window
logInWindow.frame.setStyleSheet("QFrame{\nbackground-color: rgb(36, 36, 36);\n}")
logInWindow.logo.setPixmap(QPixmap(path1+"/UIs/Imgs/logo.png"))
logInWindow.logo.setMaximumSize(5000000, 150)
logInWindow.logo.setGeometry(20, 30, 361, 150)
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_CheckBox.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
logInWindow.checkBox_password.setStyleSheet(styleSheet)
logInWindow.checkBox_Password2.setStyleSheet(styleSheet)
mainWindow.checkBox_Password.setStyleSheet(styleSheet)# <---- Main window
mainWindow.checkBox_DarkMode.setStyleSheet(styleSheet)# <---- Main window
# Main window
# History
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_History.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.textEdit.setStyleSheet(styleSheet)
# Lateral buttons
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_LateralButtons.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.btnMinMax.setStyleSheet(styleSheet)
mainWindow.btnYourAccount.setStyleSheet(styleSheet)
mainWindow.btnLogOut.setStyleSheet(styleSheet)
mainWindow.btnSettings.setStyleSheet(styleSheet)
# Info frames
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_Frames.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.frameMoney.setStyleSheet(styleSheet)
mainWindow.frameMoney_2.setStyleSheet(styleSheet)
mainWindow.frameMoney_3.setStyleSheet(styleSheet)
mainWindow.frameMoney_4.setStyleSheet(styleSheet)
mainWindow.frameMoney_5.setStyleSheet(styleSheet)
mainWindow.frameChoose.setStyleSheet(styleSheet)
mainWindow.frameChoose_2.setStyleSheet(styleSheet)
mainWindow.frameChoose_5.setStyleSheet(styleSheet)
mainWindow.frameAccount.setStyleSheet(styleSheet)
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_MoneyLabels.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.labelYourMoney.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_2.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_3.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_4.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_5.setStyleSheet(styleSheet)
mainWindow.labelChoose.setStyleSheet(styleSheet)
mainWindow.labelChoose_2.setStyleSheet(styleSheet)
mainWindow.labelChoose_5.setStyleSheet(styleSheet)
mainWindow.labelChoose_6.setStyleSheet(styleSheet)
# Side and top frames
mainWindow.topBar.setStyleSheet("QFrame{\nbackground-color: rgb(65, 65, 65);\n}")
mainWindow.sideBar.setStyleSheet("QFrame{\nbackground-color: rgb(65, 65, 65);\n}")
# Content
mainWindow.content.setStyleSheet("QFrame{\nbackground-color: rgb(36, 36, 36);\n}")
# Settings
mainWindow.scrollAreaWidgetContents_2.setStyleSheet("background-color: rgb(36, 36, 36);\nborder: none;")
# Labels
mainWindow.labelYourAccount.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_3.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_4.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_8.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_10.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_12.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_13.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_19.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_17.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_16.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_18.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_15.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_25.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_23.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.labelWelcome.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.labelUsername.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.labelVersion.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.labelCorrect.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.filling.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.title.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.text.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.label_20.setStyleSheet("QFrame{\ncolor: rgb(255, 255, 255);\n}")
mainWindow.labelMoney.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_2.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_3.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_4.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_5.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_31.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_7.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_6.setStyleSheet("QLabel{\ncolor: rgb(255, 255, 255);\nborder: none;\npadding: 1px;\n}")
def lightMode():
# Change settings
openDarkMode = open(path1+"/Data/darkMode.txt","w")
openDarkMode.write("0")
openDarkMode.close()
# Log in window
logInWindow.frame.setStyleSheet("QFrame{\nbackground-color: rgb(255, 255, 255);\n}")
logInWindow.logo.setPixmap(QPixmap(path1+"/UIs/Imgs/logo4.png"))
logInWindow.logo.setMaximumSize(5000000, 5000000)
logInWindow.logo.setGeometry(20, 30, 361, 191)
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_CheckBox_Light.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
logInWindow.checkBox_password.setStyleSheet(styleSheet)
logInWindow.checkBox_Password2.setStyleSheet(styleSheet)
mainWindow.checkBox_Password.setStyleSheet(styleSheet)# <---- Main window
mainWindow.checkBox_DarkMode.setStyleSheet(styleSheet)# <---- Main window
# Main window
# History
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_History_Light.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.textEdit.setStyleSheet(styleSheet)
# Lateral buttons
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_LateralButtons_Light.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.btnMinMax.setStyleSheet(styleSheet)
mainWindow.btnYourAccount.setStyleSheet(styleSheet)
mainWindow.btnLogOut.setStyleSheet(styleSheet)
mainWindow.btnSettings.setStyleSheet(styleSheet)
# Info frames
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_Frames_Light.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.frameMoney.setStyleSheet(styleSheet)
mainWindow.frameMoney_2.setStyleSheet(styleSheet)
mainWindow.frameMoney_3.setStyleSheet(styleSheet)
mainWindow.frameMoney_4.setStyleSheet(styleSheet)
mainWindow.frameMoney_5.setStyleSheet(styleSheet)
mainWindow.frameChoose.setStyleSheet(styleSheet)
mainWindow.frameChoose_2.setStyleSheet(styleSheet)
mainWindow.frameChoose_5.setStyleSheet(styleSheet)
mainWindow.frameAccount.setStyleSheet(styleSheet)
styleSheetData = open(path1+"/UIs/styleSheets/styleSheet_MoneyLabels_Light.txt", "r")
styleSheet = styleSheetData.read()
styleSheetData.close()
mainWindow.labelYourMoney.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_2.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_3.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_4.setStyleSheet(styleSheet)
mainWindow.labelYourMoney_5.setStyleSheet(styleSheet)
mainWindow.labelChoose.setStyleSheet(styleSheet)
mainWindow.labelChoose_2.setStyleSheet(styleSheet)
mainWindow.labelChoose_5.setStyleSheet(styleSheet)
mainWindow.labelChoose_6.setStyleSheet(styleSheet)
# Side and top frames
mainWindow.topBar.setStyleSheet("QFrame{\nbackground-color: rgb(239, 239, 239);\n}")
mainWindow.sideBar.setStyleSheet("QFrame{\nbackground-color: rgb(239, 239, 239);\n}")
# Content
mainWindow.content.setStyleSheet("QFrame{\nbackground-color: rgb(255, 255, 255);\n}")
# Settings
mainWindow.scrollAreaWidgetContents_2.setStyleSheet("background-color: rgb(255, 255, 255);\nborder: none;")
# Labels
mainWindow.labelYourAccount.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_3.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_4.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_8.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_10.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_12.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_13.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_19.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_17.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_16.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_18.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_15.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_25.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_23.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.labelWelcome.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.labelUsername.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.labelVersion.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.labelCorrect.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.filling.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.title.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.text.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.label_20.setStyleSheet("QFrame{\ncolor: rgb(0, 0, 0);\n}")
mainWindow.labelMoney.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_2.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_3.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_4.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.labelMoney_5.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_31.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_7.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
mainWindow.label_6.setStyleSheet("QLabel{\ncolor: rgb(0, 0, 0);\nborder: none;\npadding: 1px;\n}")
# Define windows and other settings
splashScreenWindow = loader.load(path1+"/UIs/splashScreen.ui", None)
logInWindow = loader.load(path1+"/UIs/logIn.ui", None)
mainWindow = loader.load(path1+"/UIs/mainWindow.ui", None)
mainWindow.stackedWidget.setCurrentWidget(mainWindow.yourAccount)
mainWindow.btnGoBack.hide()
mainWindow.textEdit.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
app.setWindowIcon(QIcon(path1+"/UIs/Imgs/icon.ico"))
# Icons and images
mainWindow.btnMinMax.setIcon(QtGui.QIcon(path1+"/UIs/Imgs/minMaxIcon.png"))
mainWindow.btnYourAccount.setIcon(QtGui.QIcon(path1+"/UIs/Imgs/homeIconClicked.png"))
mainWindow.btnSettings.setIcon(QtGui.QIcon(path1+"/UIs/Imgs/settingsIcon.png"))
mainWindow.btnGoBack.setIcon(QtGui.QIcon(path1+"/UIs/Imgs/goBackIcon.png"))
mainWindow.btnLogOut.setIcon(QtGui.QIcon(path1+"/UIs/Imgs/logOutIon.png"))
mainWindow.tick.setPixmap(QPixmap(path1+"/UIs/Imgs/correctIcon.png"))
mainWindow.interrogationIcon.setPixmap(QPixmap(path1+"/UIs/Imgs/interrogationIcon.png"))
mainWindow.interrogationIcon_2.setPixmap(QPixmap(path1+"/UIs/Imgs/interrogationIcon.png"))
mainWindow.iconError.setPixmap(QPixmap(path1+"/UIs/Imgs/errorIcon.png"))
mainWindow.btnYourAccount.setStyleSheet(btnStyleSheet.replace("fondo","qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(203, 203, 203, 255), stop:1 rgba(229, 229, 229, 255))"))
# Miscellaneous buttons
# Log in and create account icons
logInWindow.btnLogIn_2.clicked.connect(lambda: logInScript())
logInWindow.btnCreateAccount_2.clicked.connect(lambda: createAccountScript())
# Checks if checkBox is clicked and changes echoMode
logInWindow.checkBox_password.clicked.connect(lambda: checkBox1Checker())
logInWindow.checkBox_Password2.clicked.connect(lambda: checkBox2Checker())