@@ -191,13 +191,6 @@ def init_ui(self):
191191 self .setCentralWidget (self .ui )
192192
193193 # Récupérer les widgets depuis l'UI chargée
194- self .sidebar_logo = self .ui .findChild (QLabel , "sidebar_logo" )
195- # Forcer la suppression de toute bordure sur le logo, quel que soit le thème
196- try :
197- if self .sidebar_logo :
198- self .sidebar_logo .setStyleSheet ("border: none; background: transparent;" )
199- except Exception :
200- pass
201194 self .btn_select_folder = self .ui .findChild (QPushButton , "btn_select_folder" )
202195 self .venv_button = self .ui .findChild (QPushButton , "venv_button" )
203196 self .venv_label = self .ui .findChild (QLabel , "venv_label" )
@@ -208,64 +201,6 @@ def init_ui(self):
208201 self .label_logs_section = self .ui .findChild (QLabel , "label_logs_section" )
209202 self .file_list = self .ui .findChild (QListWidget , "file_list" )
210203 self .file_filter_input = self .ui .findChild (QLineEdit , "file_filter_input" )
211- # Afficher le logo dans la sidebar (chemin absolu depuis le dossier projet)
212- from PySide6 .QtGui import QPixmap
213- from PySide6 .QtWidgets import QApplication
214-
215- project_dir = os .path .abspath (os .path .dirname (sys .argv [0 ]))
216- # Choose logo based on effective theme from QSS when available; fallback to system scheme
217- try :
218- app = QApplication .instance ()
219- css = app .styleSheet () if app else ""
220- if css :
221- eff_mode = "dark" if _is_qss_dark (css ) else "light"
222- else :
223- eff_mode = _detect_system_color_scheme ()
224- except Exception :
225- eff_mode = "light"
226- candidates = [
227- os .path .join (project_dir , "logo" , "SideLogo.png" ),
228- (
229- os .path .join (project_dir , "logo" , "SideLogo2.png" )
230- if eff_mode == "dark"
231- else os .path .join (project_dir , "logo" , "SideLogo.png" )
232- ),
233- os .path .join (project_dir , "logo" , "SideLogo.png" ),
234- os .path .join (project_dir , "logo" , "SideLogo2.png" ),
235- ]
236- logo_path = None
237- for p in candidates :
238- if os .path .exists (p ):
239- logo_path = p
240- break
241- if logo_path :
242- pixmap = QPixmap (logo_path )
243- target_size = 200
244- try :
245- max_sz = self .sidebar_logo .maximumSize ()
246- if max_sz and max_sz .width () > 0 and max_sz .height () > 0 :
247- target_size = min (target_size , max_sz .width (), max_sz .height ())
248- except Exception :
249- pass
250- self .sidebar_logo .setPixmap (
251- pixmap .scaled (
252- target_size ,
253- target_size ,
254- Qt .AspectRatioMode .KeepAspectRatio ,
255- Qt .TransformationMode .SmoothTransformation ,
256- )
257- )
258- self .sidebar_logo .setToolTip ("PyCompiler" )
259- try :
260- self .sidebar_logo .setContentsMargins (13 , 0 , 0 , 0 )
261- except Exception :
262- pass
263- else :
264- self .sidebar_logo .setText ("PyCompiler" )
265- try :
266- self .sidebar_logo .setContentsMargins (12 , 0 , 0 , 0 )
267- except Exception :
268- pass
269204 self .btn_select_files = self .ui .findChild (QPushButton , "btn_select_files" )
270205 self .btn_remove_file = self .ui .findChild (QPushButton , "btn_remove_file" )
271206 self .btn_clear_workspace = self .ui .findChild (QPushButton , "btn_clear_workspace" )
@@ -599,57 +534,6 @@ def apply_theme(self, pref: str):
599534 self .select_theme .setText (val )
600535 except Exception :
601536 pass
602- # Update sidebar logo according to effective theme (dark/light)
603- try :
604- # Determine effective theme mode from applied QSS when available
605- if css :
606- effective_mode = "dark" if _is_qss_dark (css ) else "light"
607- elif not pref or pref == "System" :
608- effective_mode = _detect_system_color_scheme ()
609- else :
610- base = os .path .basename (chosen_path ) if chosen_path else ""
611- effective_mode = "dark" if "dark" in base .lower () else "light"
612- if getattr (self , "sidebar_logo" , None ) is not None :
613- from PySide6 .QtGui import QPixmap
614-
615- project_dir = os .path .abspath (os .path .dirname (sys .argv [0 ]))
616- candidates = [
617- os .path .join (project_dir , "logo" , "SideLogo.png" ),
618- (
619- os .path .join (project_dir , "logo" , "SideLogo2.png" )
620- if effective_mode == "dark"
621- else os .path .join (project_dir , "logo" , "SideLogo.png" )
622- ),
623- os .path .join (project_dir , "logo" , "SideLogo.png" ),
624- os .path .join (project_dir , "logo" , "SideLogo2.png" ),
625- ]
626- logo_path = None
627- for p in candidates :
628- if os .path .exists (p ):
629- logo_path = p
630- break
631- if logo_path :
632- pixmap = QPixmap (logo_path )
633- target_size = 200
634- try :
635- max_sz = self .sidebar_logo .maximumSize ()
636- if max_sz and max_sz .width () > 0 and max_sz .height () > 0 :
637- target_size = min (
638- target_size , max_sz .width (), max_sz .height ()
639- )
640- except Exception :
641- pass
642- self .sidebar_logo .setPixmap (
643- pixmap .scaled (
644- target_size ,
645- target_size ,
646- Qt .AspectRatioMode .KeepAspectRatio ,
647- Qt .TransformationMode .SmoothTransformation ,
648- )
649- )
650- self .sidebar_logo .setToolTip ("PyCompiler" )
651- except Exception :
652- pass
653537 # Log
654538 if hasattr (self , "log" ) and self .log :
655539 if chosen_path :
0 commit comments