From 24bae733688292e2721487d2b06ebeeb2a4cb457 Mon Sep 17 00:00:00 2001 From: Kaushal Kumar Agarwal Date: Mon, 25 Jun 2018 22:36:57 +0530 Subject: [PATCH] Added pyperclip module copy feature for dec(msg) Also now empty msgs will not be encrypted. --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index b4ff422..38e22cc 100755 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ import subprocess from more_itertools import sliced import json from fpdf import FPDF +import pyperclip # This function splits the secret and returns a list of shares def splitSecret(secret,threshold,splits): @@ -251,13 +252,16 @@ class GUI: splits = int(self.PE1.get()) threshold = int(self.PE2.get()) if (threshold > splits or threshold<2) : - messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares ") + messagebox.showwarning("Invalid!", "Minimum-Shares-Required should be greater than 2 and lesser than or equal to Total-Shares") return self.PE1.config(state='disabled') self.PE2.config(state='disabled') self.PTextBox.config(state='disabled') key = keyGen() plaintext = self.PTextBox.get("1.0",'end-1c') + if (plaintext== ""): + messagebox.showwarning("Invalid!","Message Text Box Cannot Be Left Blank!") + return shared_key = splitSecret(key,threshold,splits) ciphertext = encryptMsg(plaintext,key) try: @@ -345,7 +349,9 @@ class GUI: GScroll.pack(side = RIGHT,fill = Y) GTextFrame.grid(column=1,columnspan=2) self.GBackButton=Button(self.GetFrame,text="Back",command=self.Main) - self.GBackButton.grid(column=1) + self.GBackButton.grid(column=1) + self.CopyButton=Button(self.GetFrame,text="Copy",command=pyperclip.copy(plaintext)) + self.CopyButton.grid(column=1) root = Tk() root.title("FloSecret")