From bd71fc7ff886ed2c802d85cc63c8e7d5bb21048d Mon Sep 17 00:00:00 2001 From: Daniel Messer Date: Mon, 30 Nov 2020 06:41:38 -0800 Subject: [PATCH] Double-confirmation for database delete. --- Linux/pecos.py | 26 +++++++++++---------- Windows/export.html | 13 ++--------- Windows/item/Item data will go here.txt | 1 - Windows/patron/Patron data will go here.txt | 1 - Windows/pecos.py | 24 ++++++++++--------- macOS/pecos.py | 24 ++++++++++--------- 6 files changed, 42 insertions(+), 47 deletions(-) delete mode 100644 Windows/item/Item data will go here.txt delete mode 100644 Windows/patron/Patron data will go here.txt diff --git a/Linux/pecos.py b/Linux/pecos.py index 6a40ad2..f37f18e 100644 --- a/Linux/pecos.py +++ b/Linux/pecos.py @@ -181,18 +181,20 @@ class Toplevel1: # Next two lines commented out in Windows version - the connection commands work on macOS #conn = sqlite3.connect('checkouts.db') # Re-establish connection to the database #conn.close # Close out the current database - os.remove("checkouts.db") # Delete the current database - shutil.copy("emptybase.db", "checkouts.db") # Copy over an empty database - shutil.rmtree('item') - shutil.rmtree('patron') - os.makedirs('item') - os.makedirs('patron') - # Next two lines commented out in Windows version - the connection commands work on macOS - #conn = sqlite3.connect('checkouts.db') # Restablish connection to the database - #c = conn.cursor() - else: - messagebox.showinfo('PECOS - Database Retained','Database retained. No changes made.') - + self.ConfirmClear = tk.messagebox.askquestion ('PECOS - Confim','Final answer: Are you sure you wish to clear the database?') + if self.ConfirmClear == 'yes': + os.remove("checkouts.db") # Delete the current database + shutil.copy("emptybase.db", "checkouts.db") # Copy over an empty database + shutil.rmtree('item') + shutil.rmtree('patron') + os.makedirs('item') + os.makedirs('patron') + # Next two lines commented out in Windows version - the connection commands work on macOS + #conn = sqlite3.connect('checkouts.db') # Restablish connection to the database + #c = conn.cursor() + else: + messagebox.showinfo('PECOS - Database Retained','Database retained. No changes made.') + # --- EXPORT DATABASE TO HTML --- def ExportDatabase(): if os.path.exists("export.html"): diff --git a/Windows/export.html b/Windows/export.html index 8eaac65..3f96532 100644 --- a/Windows/export.html +++ b/Windows/export.html @@ -1,9 +1,9 @@ -PECOS Export - 06:14:31 on Wednesday, November 11, 2020 +PECOS Export - 06:37:11 on Monday, November 30, 2020 -

PECOS Export File – 06:14:31 on Wednesday, November 11, 2020

+

PECOS Export File – 06:37:11 on Monday, November 30, 2020