5454 "compile_only_main" : False ,
5555 "main_file_names" : ["main.py" , "app.py" ],
5656 "auto_detect_entry_points" : True ,
57- # PyInstaller options
58- "pyinstaller" : {
59- "onefile" : True ,
60- "windowed" : False ,
61- "noconfirm" : True ,
62- "clean" : False ,
63- "noupx" : False ,
64- "icon" : None ,
65- "debug" : False ,
66- "additional_options" : [],
67- },
68- # Nuitka options
69- "nuitka" : {
70- "onefile" : True ,
71- "standalone" : True ,
72- "disable_console" : False ,
73- "show_progress" : True ,
74- "output_dir" : None ,
75- "icon" : None ,
76- "additional_options" : [],
77- },
78- # Output configuration
79- "output" : {
80- "directory" : "dist" ,
81- "clean_before_build" : False ,
82- },
8357 # Dependencies
8458 "dependencies" : {
8559 "requirements_files" : [
10882 "bcasl_enabled" : True ,
10983 "plugin_timeout" : 0.0 ,
11084 },
111- # Engines UI state (persisted widget states per engine)
112- "engines" : {
113- "pyinstaller" : {"ui" : {"widgets" : {}}},
114- "nuitka" : {"ui" : {"widgets" : {}}},
115- },
11685}
11786
11887
@@ -321,27 +290,6 @@ def create_default_ark_config(workspace_dir: str) -> bool:
321290 - "app.py"
322291auto_detect_entry_points: true
323292
324- # PYINSTALLER OPTIONS
325- pyinstaller:
326- onefile: true
327- windowed: false
328- noconfirm: true
329- clean: false
330- noupx: false
331- icon: null
332- debug: false
333- additional_options: []
334-
335- # NUITKA OPTIONS
336- nuitka:
337- onefile: true
338- standalone: true
339- disable_console: false
340- show_progress: true
341- output_dir: null
342- icon: null
343- additional_options: []
344-
345293# OUTPUT CONFIGURATION
346294output:
347295 directory: "dist"
@@ -362,15 +310,6 @@ def create_default_ark_config(workspace_dir: str) -> bool:
362310 - "pip"
363311 auto_detect: true
364312 fallback_to_pip: true
365-
366- # ENGINES (UI state persistence)
367- engines:
368- pyinstaller:
369- ui:
370- widgets: {}
371- nuitka:
372- ui:
373- widgets: {}
374313"""
375314
376315 with open (config_file , "w" , encoding = "utf-8" ) as f :
@@ -383,142 +322,3 @@ def create_default_ark_config(workspace_dir: str) -> bool:
383322 return False
384323
385324
386- # --- Simple Engine UI state helpers (for non-dev friendly persistence) ---
387-
388-
389- def _read_yaml (path : Path ) -> dict :
390- try :
391- if path .exists ():
392- with open (path , "r" , encoding = "utf-8" ) as f :
393- data = yaml .safe_load (f ) or {}
394- return data if isinstance (data , dict ) else {}
395- except Exception :
396- pass
397- return {}
398-
399-
400- def _write_yaml_atomic (path : Path , data : dict ) -> bool :
401- try :
402- path .parent .mkdir (parents = True , exist_ok = True )
403- tmp = path .with_suffix (path .suffix + ".tmp" )
404- with open (tmp , "w" , encoding = "utf-8" ) as f :
405- yaml .safe_dump (data , f , allow_unicode = True , sort_keys = False )
406- os .replace (tmp , path )
407- return True
408- except Exception :
409- return False
410-
411-
412- essential_props = ("checked" , "text" , "enabled" , "visible" , "currentIndex" )
413-
414-
415- def load_engine_ui_state (workspace_dir : str , engine_id : str ) -> dict :
416- """Load saved UI state for an engine from ARK_Main_Config.yml (YAML ONLY).
417- Cherche les fichiers dans cet ordre:
418- 1. ARK_Main_Config.yaml
419- 2. ARK_Main_Config.yml
420- 3. .ARK_Main_Config.yaml
421- 4. .ARK_Main_Config.yml
422-
423- Returns a mapping {widgetName: {prop: value}} or {}.
424- """
425- try :
426- if not workspace_dir :
427- return {}
428-
429- workspace_path = Path (workspace_dir )
430-
431- # Chercher les fichiers YAML dans l'ordre de priorité
432- config_candidates = [
433- workspace_path / "ARK_Main_Config.yaml" ,
434- workspace_path / "ARK_Main_Config.yml" ,
435- workspace_path / ".ARK_Main_Config.yaml" ,
436- workspace_path / ".ARK_Main_Config.yml" ,
437- ]
438-
439- cfg = {}
440- for candidate in config_candidates :
441- if candidate .exists () and candidate .is_file ():
442- cfg = _read_yaml (candidate )
443- break
444-
445- engines = cfg .get ("engines" , {}) if isinstance (cfg , dict ) else {}
446- e = engines .get (str (engine_id ), {}) if isinstance (engines , dict ) else {}
447- ui = e .get ("ui" , {}) if isinstance (e , dict ) else {}
448- widgets = ui .get ("widgets" , {}) if isinstance (ui , dict ) else {}
449- return widgets if isinstance (widgets , dict ) else {}
450- except Exception :
451- return {}
452-
453-
454- def save_engine_ui_state (workspace_dir : str , engine_id : str , updates : dict ) -> bool :
455- """Save UI state for an engine into ARK_Main_Config.yml (YAML ONLY).
456- Cherche les fichiers existants dans cet ordre:
457- 1. ARK_Main_Config.yaml
458- 2. ARK_Main_Config.yml
459- 3. .ARK_Main_Config.yaml
460- 4. .ARK_Main_Config.yml
461-
462- Si aucun fichier n'existe, crée ARK_Main_Config.yml par défaut.
463-
464- - workspace_dir: project workspace path
465- - engine_id: id string (e.g. 'pyinstaller')
466- - updates: {widgetName: {prop: value}}
467- Returns True on success, False otherwise.
468- """
469- if not workspace_dir :
470- return False
471- try :
472- workspace_path = Path (workspace_dir )
473-
474- # Chercher les fichiers YAML existants dans l'ordre de priorité
475- config_candidates = [
476- workspace_path / "ARK_Main_Config.yaml" ,
477- workspace_path / "ARK_Main_Config.yml" ,
478- workspace_path / ".ARK_Main_Config.yaml" ,
479- workspace_path / ".ARK_Main_Config.yml" ,
480- ]
481-
482- cfg_path = None
483- for candidate in config_candidates :
484- if candidate .exists () and candidate .is_file ():
485- cfg_path = candidate
486- break
487-
488- # Si aucun fichier n'existe, utiliser ARK_Main_Config.yml par défaut
489- if cfg_path is None :
490- cfg_path = workspace_path / "ARK_Main_Config.yml"
491-
492- cfg = _read_yaml (cfg_path )
493- if not isinstance (cfg , dict ):
494- cfg = {}
495- engines = cfg .get ("engines" )
496- if not isinstance (engines , dict ):
497- engines = {}
498- cfg ["engines" ] = engines
499- e = engines .get (str (engine_id ))
500- if not isinstance (e , dict ):
501- e = {}
502- engines [str (engine_id )] = e
503- ui = e .get ("ui" )
504- if not isinstance (ui , dict ):
505- ui = {}
506- e ["ui" ] = ui
507- widgets = ui .get ("widgets" )
508- if not isinstance (widgets , dict ):
509- widgets = {}
510- ui ["widgets" ] = widgets
511- # Merge per widget
512- for wname , props in (updates or {}).items ():
513- if not isinstance (wname , str ) or not isinstance (props , dict ):
514- continue
515- cur = widgets .get (wname )
516- if not isinstance (cur , dict ):
517- cur = {}
518- widgets [wname ] = cur
519- for k , v in props .items ():
520- if k in essential_props :
521- cur [k ] = v
522- return _write_yaml_atomic (cfg_path , cfg )
523- except Exception :
524- return False
0 commit comments