4343
4444# Import des classes de gestion du workspace
4545from Core .WorkSpaceManager .SetupWorkspace import SetupWorkspace
46- from Core .WorkSpaceManager .WorkspaceAdvancedManipulation import WorkspaceAdvancedManipulation
46+ from Core .WorkSpaceManager .WorkspaceAdvancedManipulation import (
47+ WorkspaceAdvancedManipulation ,
48+ )
4749
4850
4951def get_selected_workspace () -> Optional [str ]:
@@ -67,15 +69,15 @@ def get_selected_workspace() -> Optional[str]:
6769class PyCompilerArkGui (QMainWindow , UiFeatures ):
6870 """
6971 Classe principale de la fenêtre GUI pour PyCompiler ARK.
70-
72+
7173 Hérité de UiFeatures pour les fonctionnalités UI déléguées.
7274 """
7375
7476 def __init__ (self ):
7577 super ().__init__ ()
7678 global _latest_gui_instance
7779 _latest_gui_instance = self
78-
80+
7981 self .setWindowTitle ("PyCompiler ARK++" )
8082 self .setGeometry (100 , 100 , 1280 , 720 )
8183 self .setAcceptDrops (True )
@@ -91,7 +93,7 @@ def __init__(self):
9193 self .current_compiling = set ()
9294 self ._closing = False
9395 self ._language_refresh_callbacks = []
94-
96+
9597 # Gestion du venv via VenvManager
9698 self .venv_manager = VenvManager (self )
9799
@@ -101,13 +103,16 @@ def __init__(self):
101103
102104 # Détection et application de la langue système
103105 import locale
106+
104107 sys_lang = None
105108 try :
106109 loc = locale .getdefaultlocale ()[0 ] or ""
107- sys_lang = "Français" if loc .lower ().startswith (("fr" , "fr_" )) else "English"
110+ sys_lang = (
111+ "Français" if loc .lower ().startswith (("fr" , "fr_" )) else "English"
112+ )
108113 except Exception :
109114 sys_lang = "English"
110-
115+
111116 pref_lang = getattr (self , "language_pref" , getattr (self , "language" , "System" ))
112117 chosen_lang = sys_lang if pref_lang == "System" else pref_lang
113118 self .apply_language (chosen_lang )
@@ -116,13 +121,22 @@ def __init__(self):
116121 # Afficher le mode de langue sur le bouton
117122 try :
118123 if self .select_lang :
124+
119125 async def _fetch_tr ():
120- effective_code = await resolve_system_language () if pref_lang == "System" else pref_lang
126+ effective_code = (
127+ await resolve_system_language ()
128+ if pref_lang == "System"
129+ else pref_lang
130+ )
121131 return await get_translations (effective_code )
122132
123133 def _apply_label (tr ):
124134 try :
125- key = "choose_language_system_button" if pref_lang == "System" else "choose_language_button"
135+ key = (
136+ "choose_language_system_button"
137+ if pref_lang == "System"
138+ else "choose_language_button"
139+ )
126140 self .select_lang .setText (
127141 (tr .get (key ) if isinstance (tr , dict ) else "" )
128142 or (tr .get ("select_lang" ) if isinstance (tr , dict ) else "" )
@@ -134,14 +148,14 @@ def _apply_label(tr):
134148 _run_coro_async (_fetch_tr (), _apply_label , ui_owner = self )
135149 except Exception :
136150 pass
137-
151+
138152 self .update_ui_state ()
139153
140154 # =========================================================================
141155 # DÉLÉGATION UI À UiFeatures
142156 # =========================================================================
143157 # Les méthodes suivantes sont déléguées à UiFeatures via l'héritage multiple
144-
158+
145159 select_icon = UiFeatures .select_icon
146160 select_nuitka_icon = UiFeatures .select_nuitka_icon
147161 show_help_dialog = UiFeatures .show_help_dialog
@@ -212,7 +226,11 @@ def open_ark_config(self):
212226 def on_main_only_changed (self ):
213227 """Gestion du changement de l'option main uniquement."""
214228 if self .opt_main_only .isChecked ():
215- mains = [f for f in self .python_files if os .path .basename (f ) in ("main.py" , "app.py" )]
229+ mains = [
230+ f
231+ for f in self .python_files
232+ if os .path .basename (f ) in ("main.py" , "app.py" )
233+ ]
216234 if len (mains ) > 1 :
217235 QMessageBox .information (
218236 self ,
@@ -275,7 +293,9 @@ def remove_selected_file(self):
275293 def tr (self , fr : str , en : str ) -> str :
276294 """Retourne le texte FR si la langue est Français, sinon EN."""
277295 try :
278- lang = str (getattr (self , "current_language" , "English" ) or "English" ).lower ()
296+ lang = str (
297+ getattr (self , "current_language" , "English" ) or "English"
298+ ).lower ()
279299 except Exception :
280300 lang = "english"
281301 return fr if lang .startswith ("fr" ) else en
@@ -305,7 +325,11 @@ def _has_active_background_tasks(self) -> bool:
305325 """Vérifie s'il y a des tâches en arrière-plan actives."""
306326 if self .processes :
307327 return True
308- if hasattr (self , "venv_manager" ) and self .venv_manager and self .venv_manager .has_active_tasks ():
328+ if (
329+ hasattr (self , "venv_manager" )
330+ and self .venv_manager
331+ and self .venv_manager .has_active_tasks ()
332+ ):
309333 return True
310334 try :
311335 bcasl_thread = getattr (self , "_bcasl_thread" , None )
@@ -386,6 +410,7 @@ def closeEvent(self, event):
386410 self ._terminate_background_tasks ()
387411 try :
388412 from bcasl .Loader import ensure_bcasl_thread_stopped
413+
389414 ensure_bcasl_thread_stopped (self )
390415 except Exception :
391416 pass
@@ -395,8 +420,8 @@ def closeEvent(self, event):
395420 else :
396421 try :
397422 from bcasl .Loader import ensure_bcasl_thread_stopped
423+
398424 ensure_bcasl_thread_stopped (self )
399425 except Exception :
400426 pass
401427 event .accept ()
402-
0 commit comments