@@ -41,6 +41,35 @@ def __init__(self):
4141 colorama .init ()
4242 self .console = Console ()
4343 self .plugin_id : Optional [str ] = None
44+ self ._ensure_qt_context ()
45+
46+ def _ensure_qt_context (self ) -> None :
47+ """Ensure a QApplication exists to allow showing Qt dialogs from plugins."""
48+ try :
49+ from PySide6 .QtWidgets import QApplication
50+ import os
51+
52+ # Skip if already initialized or in explicit headless mode
53+ if QApplication .instance () is not None :
54+ return
55+
56+ nonint = os .environ .get ("PYCOMPILER_NONINTERACTIVE" )
57+ if nonint and str (nonint ).strip ().lower () in ("1" , "true" , "yes" ):
58+ return
59+
60+ # Initialize a minimal QApplication for the sandbox process
61+ # We use an empty list for argv and set offscreen if no display
62+ try :
63+ import sys
64+ if not os .environ .get ("DISPLAY" ) and not os .environ .get ("WAYLAND_DISPLAY" ):
65+ if sys .platform != "win32" :
66+ os .environ .setdefault ("QT_QPA_PLATFORM" , "offscreen" )
67+
68+ self ._qapp = QApplication ([])
69+ except Exception :
70+ pass
71+ except Exception :
72+ pass
4473
4574 def _resolve_plugin_id (self ) -> str :
4675 """Resolve plugin id for i18n lookup.
@@ -125,15 +154,15 @@ def log(self, message: str) -> None:
125154
126155 def log_info (self , message : str ) -> None :
127156 """Log an info message."""
128- self .console .print (f"[bold green][INFO][/bold green] { message } " )
157+ self .console .print (f"ℹ️ [bold green][INFO][/bold green] { message } " )
129158
130159 def log_warn (self , message : str ) -> None :
131160 """Log a warning message."""
132- self .console .print (f"[bold yellow][WARN][/bold yellow] { message } " )
161+ self .console .print (f"⚠️ [bold yellow][WARN][/bold yellow] { message } " )
133162
134163 def log_error (self , message : str ) -> None :
135164 """Log an error message."""
136- self .console .print (f"[bold red][ERROR][/bold red] { message } " )
165+ self .console .print (f"❌ [bold red][ERROR][/bold red] { message } " )
137166
138167 def sys_msgbox_for_installing (
139168 self ,
0 commit comments