mirror of
https://github.com/Omni-guides/Jackify.git
synced 2026-06-17 20:47:45 +02:00
Sync from development - prepare for v0.4.0
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
"""Window lifecycle and resize handlers for InstallTTWScreen (Mixin)."""
|
||||
from PySide6.QtCore import QTimer, QSize, Qt
|
||||
from PySide6.QtGui import QResizeEvent
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
from ..utils import set_responsive_minimum
|
||||
|
||||
|
||||
def debug_print(message):
|
||||
"""Print debug message only if debug mode is enabled"""
|
||||
from jackify.backend.handlers.config_handler import ConfigHandler
|
||||
config_handler = ConfigHandler()
|
||||
if config_handler.get('debug_mode', False):
|
||||
print(message)
|
||||
|
||||
|
||||
class TTWLifecycleMixin:
|
||||
"""Mixin providing window lifecycle and resize management for InstallTTWScreen."""
|
||||
|
||||
@@ -58,7 +51,7 @@ class TTWLifecycleMixin:
|
||||
def showEvent(self, event):
|
||||
"""Called when the widget becomes visible"""
|
||||
super().showEvent(event)
|
||||
debug_print(f"DEBUG: TTW showEvent - integration_mode={self._integration_mode}")
|
||||
logger.debug(f"DEBUG: TTW showEvent - integration_mode={self._integration_mode}")
|
||||
|
||||
# Check TTW_Linux_Installer status asynchronously (non-blocking) after screen opens
|
||||
from PySide6.QtCore import QTimer
|
||||
@@ -80,7 +73,7 @@ class TTWLifecycleMixin:
|
||||
is_steamdeck = True
|
||||
|
||||
if is_steamdeck:
|
||||
debug_print("DEBUG: Steam Deck detected, keeping expanded")
|
||||
logger.debug("DEBUG: Steam Deck detected, keeping expanded")
|
||||
# Force expanded state and hide checkbox
|
||||
if self.show_details_checkbox.isVisible():
|
||||
self.show_details_checkbox.setVisible(False)
|
||||
@@ -91,27 +84,27 @@ class TTWLifecycleMixin:
|
||||
self.console.setMaximumHeight(16777215) # Remove height limit
|
||||
return
|
||||
except Exception as e:
|
||||
debug_print(f"DEBUG: Steam Deck check exception: {e}")
|
||||
logger.debug(f"DEBUG: Steam Deck check exception: {e}")
|
||||
pass
|
||||
debug_print(f"DEBUG: Checkbox checked={self.show_details_checkbox.isChecked()}")
|
||||
logger.debug(f"DEBUG: Checkbox checked={self.show_details_checkbox.isChecked()}")
|
||||
if self.show_details_checkbox.isChecked():
|
||||
self.show_details_checkbox.blockSignals(True)
|
||||
self.show_details_checkbox.setChecked(False)
|
||||
self.show_details_checkbox.blockSignals(False)
|
||||
|
||||
debug_print("DEBUG: Calling _toggle_console_visibility(Unchecked)")
|
||||
logger.debug("DEBUG: Calling _toggle_console_visibility(Unchecked)")
|
||||
self._toggle_console_visibility(_Qt.Unchecked)
|
||||
# Force the window to compact height to eliminate bottom whitespace
|
||||
main_window = self.window()
|
||||
debug_print(f"DEBUG: main_window={main_window}, size={main_window.size() if main_window else None}")
|
||||
logger.debug(f"DEBUG: main_window={main_window}, size={main_window.size() if main_window else None}")
|
||||
if main_window:
|
||||
# Save original geometry once
|
||||
if self._saved_geometry is None:
|
||||
self._saved_geometry = main_window.geometry()
|
||||
debug_print(f"DEBUG: Saved geometry: {self._saved_geometry}")
|
||||
logger.debug(f"DEBUG: Saved geometry: {self._saved_geometry}")
|
||||
if self._saved_min_size is None:
|
||||
self._saved_min_size = main_window.minimumSize()
|
||||
debug_print(f"DEBUG: Saved min size: {self._saved_min_size}")
|
||||
logger.debug(f"DEBUG: Saved min size: {self._saved_min_size}")
|
||||
|
||||
# Fixed compact size - same as menu screens
|
||||
from PySide6.QtCore import QSize
|
||||
@@ -127,14 +120,14 @@ class TTWLifecycleMixin:
|
||||
# Notify parent to ensure compact
|
||||
try:
|
||||
self.resize_request.emit('collapse')
|
||||
debug_print("DEBUG: Emitted resize_request collapse signal")
|
||||
logger.debug("DEBUG: Emitted resize_request collapse signal")
|
||||
except Exception as e:
|
||||
debug_print(f"DEBUG: Exception emitting signal: {e}")
|
||||
logger.debug(f"DEBUG: Exception emitting signal: {e}")
|
||||
pass
|
||||
except Exception as e:
|
||||
debug_print(f"DEBUG: showEvent exception: {e}")
|
||||
logger.debug(f"DEBUG: showEvent exception: {e}")
|
||||
import traceback
|
||||
debug_print(f"DEBUG: {traceback.format_exc()}")
|
||||
logger.debug(f"DEBUG: {traceback.format_exc()}")
|
||||
pass
|
||||
|
||||
def hideEvent(self, event):
|
||||
@@ -148,8 +141,8 @@ class TTWLifecycleMixin:
|
||||
# Important when console is expanded
|
||||
main_window.setMaximumSize(QSize(16777215, 16777215))
|
||||
main_window.setMinimumSize(QSize(0, 0))
|
||||
debug_print("DEBUG: Install TTW hideEvent - cleared window size constraints")
|
||||
logger.debug("DEBUG: Install TTW hideEvent - cleared window size constraints")
|
||||
except Exception as e:
|
||||
debug_print(f"DEBUG: hideEvent exception: {e}")
|
||||
logger.debug(f"DEBUG: hideEvent exception: {e}")
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user