1
1
from PyQt5 .QtWidgets import QApplication , QDesktopWidget
2
2
from PyQt5 import QtWidgets
3
+ from PyQt5 .QtGui import *
3
4
import sys
4
5
import string
5
6
@@ -20,8 +21,7 @@ def __init__(self):
20
21
self .setFixedSize (400 , 400 )
21
22
22
23
self .encryptButton .clicked .connect (self .button_click )
23
- self .DecryptMenuButton .clicked .connect (self .switch_to_decrypt_ui )
24
-
24
+ self .actionDecryptE .triggered .connect (self .switch_to_decrypt_ui )
25
25
26
26
def block (self ):
27
27
word_ = self .blockLineEdit .text ()
@@ -43,11 +43,14 @@ def button_click(self):
43
43
_nKey = int (self .nKey ())
44
44
if _eKey > _nKey :
45
45
self .result .setText ("e Key cannot greater than n Key!" )
46
+
46
47
else :
47
48
result_ = encryptRSA .encrypt (_block , _block2 , _eKey , _nKey )
49
+ self .result .setFont (QFont ('Arial' , 14 ))
48
50
self .result .setText (str (result_ ))
49
51
except ValueError :
50
- self .result .setText ("Integers only!" )
52
+ self .result .setFont (QFont ('Arial' , 10 ))
53
+ self .result .setText ("Please check your values. You must enter a word and two numeric keys." )
51
54
except Exception as e :
52
55
self .result .setText (str (e ))
53
56
@@ -67,7 +70,7 @@ def __init__(self):
67
70
self .setFixedSize (400 , 400 )
68
71
69
72
self .pushButton .clicked .connect (self .button_click2 )
70
- self .EncryptMenuButton . clicked .connect (self .switch_to_encrypt_ui )
73
+ self .actionEncyrptD . triggered .connect (self .switch_to_encrypt_ui )
71
74
72
75
def block (self ):
73
76
block_ = self .encLineEdit .text ()
@@ -96,8 +99,12 @@ def button_click2(self):
96
99
_eKey = int (self .eKey ())
97
100
_d = pow (_eKey , - 1 , _invModNum )
98
101
result_ = decryptRSA .decrypt (_block , _block2 , _d , _nKey )
102
+ self .textEdit .setFont (QFont ('Arial' , 14 ))
99
103
self .textEdit .setText (str (result_ ))
100
104
105
+ except ValueError :
106
+ self .textEdit .setFont (QFont ('Arial' , 10 ))
107
+ self .textEdit .setText ("Please check your values. You must enter a word, two integers and a numeric key." )
101
108
except Exception as e :
102
109
self .textEdit .setText (str (e ))
103
110
@@ -109,7 +116,6 @@ def switch_to_encrypt_ui(self):
109
116
110
117
111
118
def main ():
112
- print ("Starting the application" )
113
119
app = QApplication (sys .argv )
114
120
main_widget = MyGUI ()
115
121
main_widget .show ()
0 commit comments