3434from engine_sdk import (
3535 CompilerEngine ,
3636 EngineConfigHelper ,
37+ UIAutoSaveHelper ,
3738 SysDependencyManager ,
3839 pip_executable ,
3940 pip_install ,
@@ -53,9 +54,40 @@ class CxFreezeEngine(CompilerEngine):
5354 required_sdk_version = "1.0.0"
5455
5556 def __init__ (self ):
56- """Initialize engine with configuration helper."""
57+ """Initialize engine with configuration helper and cx_Freeze-specific defaults ."""
5758 super ().__init__ ()
58- self .config = EngineConfigHelper (self .id )
59+ self .config = EngineConfigHelper (
60+ self .id ,
61+ default_config = {
62+ # Build output settings
63+ "output_dir" : "dist" ,
64+ "target_name" : "" ,
65+
66+ # cx_Freeze options
67+ "base" : "Console" , # Console or Win32GUI (Windows only)
68+ "optimize" : 2 ,
69+ "compress" : True ,
70+ "include_msvcr" : False ,
71+
72+ # Module settings
73+ "includes" : [],
74+ "excludes" : [],
75+ "packages" : [],
76+ "replace_paths" : [],
77+
78+ # Zip settings
79+ "include_files" : [],
80+ "zip_include_packages" : [],
81+ "zip_exclude_packages" : [],
82+
83+ # Build options
84+ "silent" : False ,
85+ "build_exe" : "" ,
86+
87+ # Environment
88+ "env_vars" : {},
89+ }
90+ )
5991
6092 def _resolve_venv_root (self , gui ) -> Optional [str ]:
6193 """Resolve project venv root."""
@@ -375,7 +407,7 @@ def environment(self, gui, file: str) -> Optional[dict[str, str]]:
375407 return None
376408
377409 def create_tab (self , gui ):
378- """Create configuration tab."""
410+ """Create configuration tab with auto-save ."""
379411 try :
380412 from PySide6 .QtWidgets import QWidget
381413
@@ -391,7 +423,6 @@ def create_tab(self, gui):
391423 QLabel ,
392424 QLineEdit ,
393425 QComboBox ,
394- QPushButton ,
395426 )
396427
397428 tab = QWidget ()
@@ -400,11 +431,15 @@ def create_tab(self, gui):
400431 # Load configuration
401432 self .config .load (gui )
402433
434+ # Create auto-save helper
435+ auto_save = UIAutoSaveHelper (self .config , gui )
436+
403437 # Output directory
404438 row1 = QHBoxLayout ()
405439 row1 .addWidget (QLabel ("Output Directory:" ))
406440 output_edit = QLineEdit ()
407441 output_edit .setText (self .config .get (gui , "output_dir" , default = "dist" ))
442+ auto_save .connect_line_edit (output_edit , "output_dir" )
408443 row1 .addWidget (output_edit )
409444 layout .addLayout (row1 )
410445
@@ -413,6 +448,7 @@ def create_tab(self, gui):
413448 row2 .addWidget (QLabel ("Target Name:" ))
414449 target_edit = QLineEdit ()
415450 target_edit .setText (self .config .get (gui , "target_name" , default = "" ))
451+ auto_save .connect_line_edit (target_edit , "target_name" )
416452 row2 .addWidget (target_edit )
417453 layout .addLayout (row2 )
418454
@@ -425,24 +461,10 @@ def create_tab(self, gui):
425461 base_combo .setCurrentText (
426462 self .config .get (gui , "base" , default = "Console" )
427463 )
464+ auto_save .connect_combobox (base_combo , "base" )
428465 row3 .addWidget (base_combo )
429466 layout .addLayout (row3 )
430- else :
431- base_combo = None
432-
433- # Save button
434- save_btn = QPushButton ("Save Configuration" )
435-
436- def _save_config ():
437- self .config .set (gui , "output_dir" , output_edit .text ())
438- self .config .set (gui , "target_name" , target_edit .text ())
439- if base_combo :
440- self .config .set (gui , "base" , base_combo .currentText ())
441- self .config .save (gui )
442- safe_log (gui , "✅ cx_Freeze configuration saved" )
443467
444- save_btn .clicked .connect (_save_config )
445- layout .addWidget (save_btn )
446468 layout .addStretch ()
447469
448470 return tab , "cx_Freeze"
0 commit comments