Basic database backup feature added.

This commit is contained in:
2020-12-01 11:35:20 -08:00
parent bd6b70708d
commit b60937b4b5
2 changed files with 70 additions and 1 deletions

44
PECOS - Set up.iss Normal file
View File

@ -0,0 +1,44 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "PECOS - Polaris Emergency Check Out System"
#define MyAppVersion "1.1 Beta"
#define MyAppPublisher "Tanglewood Hill"
#define MyAppExeName "pecos.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{12C1E773-3C56-4243-A0EC-34EC567097E9}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName=C:\PECOS
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputBaseFilename=mysetup
SetupIconFile=C:\Users\danie\Workbench\Windows\PECOS.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\danie\Workbench\Windows\pecos.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\danie\Workbench\Windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

View File

@ -231,7 +231,32 @@ class Toplevel1:
#subprocess.run(['open', 'export.html'], check=True) # Open export.html in the default web browser (macOS)
os.startfile('export.html') # Open export.html in the default web browser (Windows)
# --- BACKUP THE DATABASE AND BARCODES EVERY FIVE MINTUES ---
def BackupData():
# Set path variables for backup folders
ItemFolder = 'item/'
ItemBackup = 'itembackup/'
PatronFolder = 'patron/'
PatronBackup = 'patronbackup/'
DatabaseFile = 'checkouts.db'
dbBackup = 'checkouts-backup.db'
# Check to see if backup folders are there. If so, delete them.
if os.path.exists(ItemBackup):
shutil.rmtree(ItemBackup)
if os.path.exists(PatronBackup):
shutil.rmtree(PatronBackup)
if os.path.exists(dbBackup):
os.remove(dbBackup)
# Copy item, patron, and database folder to Backup
shutil.copytree(ItemFolder, ItemBackup)
shutil.copytree(PatronFolder, PatronBackup)
shutil.copy(DatabaseFile, dbBackup)
# --- END OF FUNCTIONS - BEGIN GUI ---
self.Canvas1 = tk.Canvas(top)
self.image = ImageTk.PhotoImage(Image.open("bg-01.png"))