51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
# BackupApp/backup_app/__main__.py
|
|
|
|
import tkinter as tk
|
|
import sys
|
|
|
|
# Assicurati che la directory genitore (BackupApp/) sia nel sys.path se necessario,
|
|
# specialmente se esegui direttamente questo file e non come modulo.
|
|
# Se esegui con `python -m backup_app`, Python lo gestisce.
|
|
# from pathlib import Path
|
|
# project_root = Path(__file__).resolve().parent.parent
|
|
# if str(project_root) not in sys.path:
|
|
# sys.path.insert(0, str(project_root))
|
|
|
|
try:
|
|
from backuptools.gui.main_window import BackupApplicationWindow
|
|
from backuptools.config import settings as app_settings # Per inizializzare/verificare config se necessario
|
|
except ImportError as e:
|
|
# Questo blocco è utile se si tenta di eseguire __main__.py direttamente
|
|
# senza che il pacchetto sia correttamente installato o PYTHONPATH configurato.
|
|
print("Error: Could not import BackupApp modules. Ensure the application is run correctly "
|
|
"(e.g., 'python -m backup_app' from the parent directory of 'backup_app' package "
|
|
"or ensure 'BackupApp' project root is in PYTHONPATH).")
|
|
print(f"Import error detail: {e}")
|
|
sys.exit(1)
|
|
|
|
|
|
def main():
|
|
"""
|
|
Main function to launch the Backup Manager application.
|
|
"""
|
|
# Qui potresti voler fare controlli preliminari, come verificare
|
|
# se il file di configurazione esiste o ha permessi corretti,
|
|
# anche se app_settings.load_application_data() gestisce la sua creazione/default.
|
|
print(f"Starting Backup Manager...")
|
|
print(f"Configuration will be loaded/saved from: {app_settings.CONFIG_FILE_PATH}")
|
|
|
|
root = tk.Tk()
|
|
app = BackupApplicationWindow(root)
|
|
# Puoi impostare qui altre proprietà della root window se necessario,
|
|
# come l'icona (se non gestita da PyInstaller nel .spec)
|
|
# example: root.iconbitmap('path/to/your/icon.ico')
|
|
|
|
root.mainloop()
|
|
|
|
if __name__ == "__main__":
|
|
# Questo blocco viene eseguito se lo script è chiamato direttamente
|
|
# (es. python backup_app/__main__.py)
|
|
# Per lanciare correttamente l'applicazione come pacchetto, usa:
|
|
# python -m backup_app
|
|
# dalla directory che contiene la cartella `backup_app` (cioè `BackupApp/`).
|
|
main() |