Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JingShing authored Nov 1, 2022
1 parent db58485 commit f345f33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Encryptor&Decryptor/Encryptor&Decryptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,29 @@ def set_label_text(self):
def import_set(self):# import spell book
set_path = filedialog.askopenfilename()
if set_path:
self.status = 'File'
self.file_name = set_path.split('/')[-1]
self.now_file_name.set(self.now_file_str + self.file_name)
self.data = load_file(set_path)
self.set_label_text()

def encrypt_file(self):
if self.file_name != 'None' and len(self.data)>0:
key = self.key_text.get("1.0",END)
file_name = self.file_name.split('.')
save_path = file_name[0] + '_en.' + file_name[-1]
save_file(save_path, list_encrypt(self.data, key))
self.status = 'Done enc'
self.set_label_text()

def decrypt_file(self):
if self.file_name != 'None' and len(self.data)>0:
key = self.key_text.get("1.0",END)
file_name = self.file_name.split('.')
save_path = file_name[0] + '_de.' + file_name[-1]
save_file(save_path, list_decrypt(self.data, key))
self.status = 'Done dect'
self.set_label_text()

main = Gui_helper_main()
main.run()

0 comments on commit f345f33

Please sign in to comment.