diff --git a/ArchiviaMailGui.py b/ArchiviaMailGui.py index e00b891..b14bd3f 100644 --- a/ArchiviaMailGui.py +++ b/ArchiviaMailGui.py @@ -1,4 +1,3 @@ -import win32com.client import os import hashlib import logging @@ -7,6 +6,7 @@ from typing import Dict from enum import IntEnum import time from nicegui import ui, run +import win32com.client # --- CONFIGURAZIONE LOGGING --- logging.basicConfig( @@ -219,23 +219,23 @@ archiver = ArchiverGUI() @ui.page('/') def main_page(): ui.query('body').style('background-color: #f0f2f5; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;') - + with ui.header().classes('items-center justify-between bg-blue-9 shadow-4 q-pa-md'): ui.label('Outlook Smart Archiver').classes('text-h5 text-white font-bold') ui.icon('inventory_2', size='lg', color='white') with ui.column().classes('w-full max-w-3xl mx-auto q-pa-lg gap-6'): - + # CARD CONFIGURAZIONE with ui.card().classes('w-full q-pa-md shadow-2 border-l-4 border-blue-9'): ui.label('Configurazione').classes('text-h6 text-blue-9 mb-2') - - arc_name = ui.input('Nome dell\'Archivio Online', + + arc_name = ui.input('Nome dell\'Archivio Online', value='Archivio Online - Nome.Cognome@intesasanpaolo.com').classes('w-full') - - od_path = ui.input('Percorso locale OneDrive per Allegati', + + od_path = ui.input('Percorso locale OneDrive per Allegati', value=r'C:\Users\--UTENZA--\OneDrive - Intesa SanPaolo\Allegati_Outlook').classes('w-full') - + with ui.row().classes('w-full items-center mt-4 bg-grey-2 q-pa-sm rounded'): ui.label('Mesi da mantenere nella Inbox:') slider = ui.slider(min=0, max=24, value=6).classes('col px-4') @@ -256,15 +256,17 @@ def main_page(): .style('text-shadow: 1px 1px 3px rgba(0,0,0,0.4); font-size: 1.2rem;') with ui.row().classes('w-full justify-center mt-8 gap-4'): - ui.button('AVVIA ARCHIVIAZIONE', icon='rocket_launch', color='green-8', + start_btn = ui.button('AVVIA ARCHIVIAZIONE', icon='rocket_launch', color='green-8', on_click=lambda: archiver.start_archiving(arc_name.value, od_path.value, slider.value)) \ - .classes('q-px-lg').bind_enabled_from(archiver, 'running', backward=lambda x: not x) - - ui.button('STOP', icon='block', color='red-8', + .classes('q-px-lg') + start_btn.bind_enabled_from(archiver, 'running', backward=lambda x: not x) + + ui.button('STOP', icon='block', color='red-8', on_click=lambda: setattr(archiver, 'running', False)) \ .classes('q-px-lg').bind_enabled_from(archiver, 'running') ui.markdown('--- \n *Ricorda: Chiudi Outlook prima di avviare il processo per evitare blocchi.*').classes('text-center text-grey-6 text-xs') # Avvio dell'applicazione -ui.run(native=True, window_size=(800, 600), title='Outlook Archiver Pro') \ No newline at end of file +if __name__ == '__main__': + ui.run(native=True, window_size=(800, 600), title='Outlook Archiver Pro') \ No newline at end of file diff --git a/uv.lock b/uv.lock index 6c2484e..3457963 100644 --- a/uv.lock +++ b/uv.lock @@ -120,7 +120,7 @@ source = { virtual = "." } dependencies = [ { name = "nicegui" }, { name = "pywebview" }, - { name = "pywin32" }, + { name = "pywin32", marker = "sys_platform == 'win32'" }, { name = "tqdm" }, ] @@ -128,7 +128,7 @@ dependencies = [ requires-dist = [ { name = "nicegui", specifier = ">=3.5.0" }, { name = "pywebview", specifier = ">=6.1" }, - { name = "pywin32", specifier = ">=311" }, + { name = "pywin32", marker = "sys_platform == 'win32'", specifier = ">=311" }, { name = "tqdm", specifier = ">=4.67.1" }, ]