32 lines
972 B
Python
32 lines
972 B
Python
|
|
from os import path
|
|
from models.database import Database
|
|
from models.user import User
|
|
from services.search import Search
|
|
from services.utils import Utils
|
|
from ui.input_menu import InputMenu, Validator
|
|
from ui.selection_menu import SelectionMenu
|
|
|
|
class BackupMenu:
|
|
@staticmethod
|
|
def create_backup():
|
|
print(f"Exporting database to file: backup.zip")
|
|
Utils.export_db()
|
|
input(f"Exported database. Press any key to return.")
|
|
|
|
@staticmethod
|
|
def import_backup():
|
|
menu = SelectionMenu("Import Backup? This will delete current database!")
|
|
menu.add_option("Yes", True)
|
|
menu.add_option("No", False)
|
|
option = menu.display().input_option()
|
|
|
|
if option == False:
|
|
return
|
|
|
|
print("Cleared current database.")
|
|
Database.delete_tables()
|
|
|
|
print(f"Importing database from file: backup.zip")
|
|
Utils.import_db()
|
|
input(f"Imported database. Press any key to return.") |