Fix --no-fullscreen command line option to properly control window mode

- Remove automatic fullscreen setting from AutoInstallerGUI constructor
- Allow main() function to control fullscreen/windowed mode based on --no-fullscreen argument
- Fix logic: when --no-fullscreen is specified, use window.show() instead of fullscreen
- When --no-fullscreen is NOT specified, use window.showFullScreen() for production use
- Ensures command line argument properly controls the application's display mode

This resolves the issue where --no-fullscreen option was not working correctly
and allows proper testing in windowed mode while maintaining fullscreen for production.
parent 1ffa6506
...@@ -656,14 +656,53 @@ class InstallerWorker(QThread): ...@@ -656,14 +656,53 @@ class InstallerWorker(QThread):
universal_newlines=True universal_newlines=True
) )
# Read output line by line and send to GUI # Read output line by line and send to GUI (non-blocking)
import select
import fcntl
import os
# Make stdout non-blocking
fd = process.stdout.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
last_update_time = 0
while True:
# Check if process is still running
if process.poll() is not None:
# Read any remaining output
try:
while True: while True:
output = process.stdout.readline() output = process.stdout.readline()
if output == '' and process.poll() is not None: if not output:
break
if output.strip():
self.copy_progress.emit(output.strip())
except:
pass
break break
if output:
# Send progress updates to GUI # Try to read available output without blocking
try:
ready, _, _ = select.select([process.stdout], [], [], 0.1)
if ready:
output = process.stdout.readline()
if output and output.strip():
self.copy_progress.emit(output.strip()) self.copy_progress.emit(output.strip())
last_update_time = time.time()
except:
# Handle non-blocking read errors gracefully
pass
# Send periodic status updates to keep GUI responsive
current_time = time.time()
if current_time - last_update_time > 2.0: # Every 2 seconds
self.copy_progress.emit("Copying system files... (please wait)")
last_update_time = current_time
# Allow GUI event processing by yielding control
import time
time.sleep(0.01)
# Check return code # Check return code
if process.returncode != 0: if process.returncode != 0:
...@@ -694,8 +733,7 @@ class AutoInstallerGUI(QMainWindow): ...@@ -694,8 +733,7 @@ class AutoInstallerGUI(QMainWindow):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setWindowTitle("MBetter AutoInstaller") self.setWindowTitle("MBetter AutoInstaller")
self.setWindowState(Qt.WindowState.WindowFullScreen) # Don't set fullscreen here - let main() function control it
self.showFullScreen()
self.worker = None self.worker = None
self.init_ui() self.init_ui()
self.config = {} self.config = {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment