Double-confirmation for database delete.

This commit is contained in:
2020-11-30 06:41:38 -08:00
parent 8bdddd2e16
commit bd71fc7ff8
6 changed files with 42 additions and 47 deletions

View File

@ -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"):