1212from voxkit .config .app_config import AppConfig , get_app_config , get_profile_config_path
1313from voxkit .config .logging_config import setup_logging
1414
15- # Disable Qt emoji support to prevent crashes in frozen builds
16-
15+ # Minimal early config so frozen-env messages below are emitted before
16+ # setup_logging() runs in main(); setup_logging() will reconfigure handlers.
17+ logging .basicConfig (level = logging .INFO , format = "%(asctime)s %(levelname)s %(name)s: %(message)s" )
18+ log = logging .getLogger ("voxkit.main" )
1719
1820# CRITICAL: Must be at the top for frozen apps using multiprocessing
1921if __name__ == "__main__" :
5557 if conda_bin :
5658 existing_path = os .environ .get ('PATH' , '/usr/bin:/bin:/usr/sbin:/sbin' )
5759 minimal_env ['PATH' ] = f"{ conda_bin } :{ existing_path } "
58- print ( f "[FROZEN] Added conda to PATH: { conda_bin } " )
60+ log . info ( "[FROZEN] Added conda to PATH: %s" , conda_bin )
5961 else :
6062 minimal_env ['PATH' ] = os .environ .get ('PATH' , '/usr/bin:/bin:/usr/sbin:/sbin' )
61- print ("[FROZEN] Warning: conda not found in standard locations. MFA alignment may fail." )
63+ log . warning ("[FROZEN] conda not found in standard locations. MFA alignment may fail." )
6264
6365 # PyInstaller-specific: Add Qt plugin paths
6466 if getattr (sys , '_MEIPASS' , None ):
6769 if os .path .exists (qt_plugins ):
6870 minimal_env ['QT_PLUGIN_PATH' ] = qt_plugins
6971 minimal_env ['QT_QPA_PLATFORM_PLUGIN_PATH' ] = os .path .join (qt_plugins , 'platforms' )
70-
72+
7173 # Additional Qt environment for frozen apps
7274 minimal_env ['QT_AUTO_SCREEN_SCALE_FACTOR' ] = '1'
7375 minimal_env ['QT_LOGGING_RULES' ] = '*.debug=false;qt.qpa.*=false'
74-
75- print ( f "[FROZEN] Qt plugins directory: { qt_plugins } " )
76- print ( f "[FROZEN] Bundle directory: { bundle_dir } " )
76+
77+ log . info ( "[FROZEN] Qt plugins directory: %s" , qt_plugins )
78+ log . info ( "[FROZEN] Bundle directory: %s" , bundle_dir )
7779
7880 # IMPORTANT: Don't clear os.environ - preserve system environment
7981 # Just add/override our minimal required variables
8082 for key , value in minimal_env .items ():
8183 if value :
8284 os .environ [key ] = value
83-
84- print ("[FROZEN] Environment configured for frozen app" )
85-
8685
86+ log .info ("[FROZEN] Environment configured for frozen app" )
8787
8888from PyQt6 .QtWidgets import QApplication
8989from voxkit .config import STARTUP_SCRIPT
90- from voxkit .gui import AlignmentGUI
90+ from voxkit .gui import VoxKitGUI
9191from voxkit .gui .workers .startup import execute_startup_script
92- from pathlib import Path
93-
9492
9593def main ():
9694 # Initialize logging as early as possible so startup work is captured.
@@ -108,7 +106,6 @@ def main():
108106 from voxkit .gui .components .log_handler import get_gui_log_handler
109107 get_gui_log_handler ()
110108
111- log = logging .getLogger ("voxkit.main" )
112109 log .info ("VoxKit starting (frozen=%s)" , bool (getattr (sys , "frozen" , False )))
113110
114111 app = QApplication (sys .argv )
@@ -128,14 +125,13 @@ def main():
128125 app_config = AppConfig .from_yaml (profile_path / "app_info.yaml" )
129126 pipeline_config = PipelineConfig .from_yaml (profile_path / "pipeline_definitions.yaml" )
130127
131- window = AlignmentGUI (pipeline_config = pipeline_config , app_config = app_config )
128+ window = VoxKitGUI (pipeline_config = pipeline_config , app_config = app_config )
132129 window .show ()
133130 log .info ("Main window shown, entering Qt event loop" )
134131 sys .exit (app .exec ())
135132
136133
137134if __name__ == "__main__" :
138135 # Prevent multiprocessing from spawning new app windows in frozen builds
139- multiprocessing .freeze_support ()
140136 multiprocessing .set_start_method ('spawn' , force = True )
141137 main ()
0 commit comments