2828 QPushButton ,
2929 QTextEdit ,
3030 QVBoxLayout ,
31+ QScrollArea ,
32+ QSizePolicy ,
3133)
3234
3335from Core import i18n as _i18n
@@ -133,14 +135,10 @@ def _detect_system_color_scheme() -> str:
133135
134136def init_ui (self ):
135137 loader = QUiLoader ()
136- # Prefer V2 UI (IDE-like). Fallback to legacy if not found.
137- ui_v2_path = os .path .abspath (
138- os .path .join (os .path .dirname (os .path .abspath (__file__ )), ".." , "ui" , "ui_design_v2.ui" )
139- )
140- ui_legacy_path = os .path .abspath (
138+ # Use legacy UI exclusively
139+ ui_path = os .path .abspath (
141140 os .path .join (os .path .dirname (os .path .abspath (__file__ )), ".." , "ui" , "ui_design.ui" )
142141 )
143- ui_path = ui_v2_path if os .path .exists (ui_v2_path ) else ui_legacy_path
144142
145143 ui_file = QFile (ui_path )
146144 ui_file .open (QFile .ReadOnly )
@@ -190,6 +188,28 @@ def init_ui(self):
190188 actionsPanel = self .ui .findChild (_QW , "actionsPanel" )
191189 centerPanel = self .ui .findChild (_QW , "centerPanel" )
192190 optionsPanel = self .ui .findChild (_QW , "optionsPanel" )
191+ # Ensure side panels are scrollable to avoid overflow on small screens
192+ try :
193+ # QScrollArea already imported at module level; avoid shadowing local
194+ if self .mainSplitter :
195+ # Wrap left actionsPanel
196+ if actionsPanel and actionsPanel .parent () == self .mainSplitter :
197+ sa_left = QScrollArea ()
198+ sa_left .setObjectName ("actionsPanelScroll" )
199+ sa_left .setWidgetResizable (True )
200+ actionsPanel .setParent (None )
201+ sa_left .setWidget (actionsPanel )
202+ self .mainSplitter .insertWidget (0 , sa_left )
203+ # Wrap right optionsPanel
204+ if optionsPanel and optionsPanel .parent () == self .mainSplitter :
205+ sa_right = QScrollArea ()
206+ sa_right .setObjectName ("optionsPanelScroll" )
207+ sa_right .setWidgetResizable (True )
208+ optionsPanel .setParent (None )
209+ sa_right .setWidget (optionsPanel )
210+ self .mainSplitter .addWidget (sa_right )
211+ except Exception :
212+ pass
193213 if self .mainSplitter :
194214 try :
195215 self .mainSplitter .setChildrenCollapsible (True )
@@ -198,7 +218,23 @@ def init_ui(self):
198218 self .mainSplitter .setCollapsible (idx , True )
199219 except Exception :
200220 pass
201- self .mainSplitter .setSizes ([260 , 700 , 360 ])
221+ try :
222+ from PySide6 .QtGui import QGuiApplication
223+ screen = QGuiApplication .primaryScreen ()
224+ avail_w = screen .availableGeometry ().width () if screen else 1200
225+ except Exception :
226+ avail_w = 1200
227+ # Compute sizes with reasonable proportions and minimums
228+ left = max (200 , int (avail_w * 0.22 ))
229+ right = max (240 , int (avail_w * 0.24 ))
230+ center = max (300 , int (avail_w - (left + right )))
231+ self .mainSplitter .setSizes ([left , center , right ])
232+ try :
233+ self .mainSplitter .setStretchFactor (0 , 0 )
234+ self .mainSplitter .setStretchFactor (1 , 1 )
235+ self .mainSplitter .setStretchFactor (2 , 0 )
236+ except Exception :
237+ pass
202238 except Exception :
203239 pass
204240 # Create a vertical splitter for editor/console inside centerPanel
@@ -225,7 +261,20 @@ def init_ui(self):
225261 centerSplitter .addWidget (consolePanel )
226262 centerLayout .addWidget (centerSplitter )
227263 try :
228- centerSplitter .setSizes ([500 , 200 ])
264+ try :
265+ from PySide6 .QtGui import QGuiApplication
266+ screen = QGuiApplication .primaryScreen ()
267+ avail_h = screen .availableGeometry ().height () if screen else 800
268+ except Exception :
269+ avail_h = 800
270+ editor_h = max (260 , int (avail_h * 0.62 ))
271+ console_h = max (120 , int (avail_h * 0.22 ))
272+ centerSplitter .setSizes ([editor_h , console_h ])
273+ try :
274+ centerSplitter .setStretchFactor (0 , 1 )
275+ centerSplitter .setStretchFactor (1 , 0 )
276+ except Exception :
277+ pass
229278 except Exception :
230279 pass
231280 self .centerSplitter = centerSplitter
@@ -857,6 +906,18 @@ def nuitka_standalone_changed(state):
857906 except Exception :
858907 pass
859908
909+ # Auto-fit main window to screen bounds
910+ try :
911+ from PySide6 .QtGui import QGuiApplication
912+ scr = QGuiApplication .primaryScreen ()
913+ if scr :
914+ avail = scr .availableGeometry ()
915+ target_w = min (max (800 , self .width ()), max (640 , avail .width () - 24 ))
916+ target_h = min (max (500 , self .height ()), max (480 , avail .height () - 24 ))
917+ self .resize (target_w , target_h )
918+ except Exception :
919+ pass
920+
860921
861922def add_pyinstaller_data (self ):
862923 import os
0 commit comments