| 7i(dZddlZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddl mZejej d ej"eZd efd Zd ed e fd ZdZd efdZedk(rej6eyy)z]ChefSystem - Main Entry Point. This module initializes and runs the ChefSystem application. N)Path) QApplication QMessageBox)Qt)DatabaseManager) MainWindowz4%(asctime)s - %(name)s - %(levelname)s - %(message)s)levelformatreturnctd} t|d5}tj|}tj d||cdddS#1swYyxYw#t $r"tjd|dddgdcYStj$r)}tjd |dddgdcYd}~Sd}~wwxYw) zmLoad application configuration from settings.json. Returns: dict: Configuration dictionary. zconfig/settings.jsonrzConfiguration loaded from NzConfiguration file not found: zdatabase/chef.dbzoutputs/) database_pathoutputs_directorywindow_geometry recent_tagsz"Error parsing configuration file: ) ropenjsonloadloggerinfoFileNotFoundErrorerrorJSONDecodeError) config_pathfconfiges //mnt/ssd/data/python-lab/ChefSystem/src/main.py load_configrs -.K +s # qYYq\F KK4[MB C      5k]CD/!+#       9!=>/!+#    s@ A/A AAAA(CCB>8C>Cdb_pathc t|}|jtjd|S#t$r }tj d|dd}~wwxYw)zInitialize the database connection and schema. Args: db_path: Path to the database file. Returns: DatabaseManager: Initialized database manager. z!Database initialized successfullyzFailed to initialize database: Texc_infoN)r init_databaserr Exceptionr)r dbrs rinitialize_databaser'6sZ W %  78  6qc:T J s14 AAAcftjd|||ftj|||y)zGlobal exception handler for uncaught exceptions. Args: exctype: Exception type. value: Exception value. traceback: Exception traceback. zUncaught exceptionr"N)rrsys__excepthook__)exctypevalue tracebacks rexception_hookr.Is. LL%%0KLLwy1cBtt_ttj}|j d|j d|jd t}tjdt|d}t||}|jtjd|jS#t$r}tj!d|dt#}|j%t"j&j(|j+d |j-d |j/t1||j3d t5|j6|jYd }~y d }~wwxYw)zlInitialize and run the ChefSystem application. Returns: int: Exit code of the application. ChefSystemzChefSystem - AI Prompt ManagerzStarting ChefSystem applicationrz+ChefSystem application started successfullyz"Fatal error starting application: Tr"zChefSystem - Fatal ErrorzFailed to start ChefSystemz Error type: N)r.r) excepthookrargvsetApplicationNamesetOrganizationNamesetApplicationDisplayNamerrrr'rshowexecr%rrsetIconIconCriticalsetWindowTitlesetTextsetInformativeTextstrsetDetailedTexttype__name__)apprr& main_windowr error_dialogs rmainrGUsO$CN sxx C<(L)!!"BC 56!!8 9!V,  ABxxz   9!= M#} [--667##$>?9:''A/$$|DG4D4D3E%FG sA-C FCFF__main__)__doc__r)rloggingpathlibrPyQt6.QtWidgetsrr PyQt6.QtCorersrc.database.db_managerrsrc.ui.main_windowr basicConfigINFO getLoggerrCrdictrr@r'r.intrGexitr/rrWs  53) ,, A   8 $ T <& 2,c,^ z CHHTVr/