Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
1bd7c23419
|
|||
|
f4275dd465
|
|||
|
c8b91c4687
|
|||
|
4aaeb2e809
|
|||
|
b6ea9350fa
|
@@ -183,23 +183,39 @@ def get_portproton_start_command():
|
||||
if not portproton_path:
|
||||
return None
|
||||
|
||||
# Check if flatpak command exists before trying to run it
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["flatpak", "list"],
|
||||
subprocess.run(
|
||||
["flatpak", "--version"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
timeout=10
|
||||
timeout=5
|
||||
)
|
||||
if "ru.linux_gaming.PortProton" in result.stdout:
|
||||
logger.info("Detected Flatpak installation")
|
||||
return ["flatpak", "run", "ru.linux_gaming.PortProton"]
|
||||
except subprocess.TimeoutExpired:
|
||||
logger.warning("Flatpak list command timed out")
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.warning(f"Error checking flatpak list: {e}")
|
||||
pass
|
||||
flatpak_available = True
|
||||
except FileNotFoundError:
|
||||
flatpak_available = False
|
||||
except Exception:
|
||||
flatpak_available = False
|
||||
|
||||
if flatpak_available:
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["flatpak", "list"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
timeout=10
|
||||
)
|
||||
if "ru.linux_gaming.PortProton" in result.stdout:
|
||||
logger.info("Detected Flatpak installation")
|
||||
return ["flatpak", "run", "ru.linux_gaming.PortProton"]
|
||||
except subprocess.TimeoutExpired:
|
||||
logger.warning("Flatpak list command timed out")
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.warning(f"Error checking flatpak list: {e}")
|
||||
pass
|
||||
|
||||
start_sh_path = os.path.join(portproton_path, "data", "scripts", "start.sh")
|
||||
if os.path.exists(start_sh_path):
|
||||
|
||||
@@ -1973,6 +1973,9 @@ class ExeSettingsDialog(QDialog):
|
||||
if re.match(r'^[A-Z_0-9]+=[^=]+$', line_stripped) and not line_stripped.startswith('PW_'):
|
||||
# System info
|
||||
k, v = line_stripped.split('=', 1)
|
||||
# Remove surrounding quotes from the value if present
|
||||
if v.startswith('"') and v.endswith('"') and len(v) >= 2:
|
||||
v = v[1:-1]
|
||||
if k.startswith('NUMA_NODE_'):
|
||||
node_id = k[10:]
|
||||
self.numa_nodes[node_id] = v
|
||||
@@ -2019,6 +2022,9 @@ class ExeSettingsDialog(QDialog):
|
||||
try:
|
||||
key, val = line_stripped.split('=', 1)
|
||||
if key in self.toggle_settings or key in ADVANCED_SETTING_KEYS:
|
||||
# Remove surrounding quotes from the value if present
|
||||
if val.startswith('"') and val.endswith('"') and len(val) >= 2:
|
||||
val = val[1:-1]
|
||||
self.current_settings[key] = val
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
@@ -505,17 +505,25 @@ class GameLibraryManager:
|
||||
"""Clears all widgets from the layout."""
|
||||
if layout is None:
|
||||
return
|
||||
# Remove all widgets from the layout and clean up caches
|
||||
while layout.count():
|
||||
child = layout.takeAt(0)
|
||||
if child.widget():
|
||||
widget = child.widget()
|
||||
# Clean up cache if widget exists in it
|
||||
for key, card in list(self.game_card_cache.items()):
|
||||
if card == widget:
|
||||
del self.game_card_cache[key]
|
||||
if key in self.pending_images:
|
||||
del self.pending_images[key]
|
||||
break
|
||||
# Always schedule widget for deletion regardless of cache state
|
||||
widget.deleteLater()
|
||||
|
||||
# Also clear the cache completely if needed (in case layout wasn't in sync)
|
||||
self.game_card_cache.clear()
|
||||
self.pending_images.clear()
|
||||
|
||||
def set_games(self, games: list[tuple]):
|
||||
"""Sets the games list and updates the filtered games."""
|
||||
self.games = games
|
||||
|
||||
@@ -1939,8 +1939,10 @@ class InputManager(QObject):
|
||||
active_win.show_next()
|
||||
return True # Consume event to prevent tab switching
|
||||
|
||||
# Handle tab switching with Left/Right arrow keys when not in GameCard focus or QLineEdit
|
||||
if key in (Qt.Key.Key_Left, Qt.Key.Key_Right) and not isinstance(focused, GameCard | QLineEdit) and not self.file_explorer:
|
||||
# Handle tab switching with Left/Right arrow keys when not in GameCard focus or QLineEdit or QTableWidget or AutoSizeButton
|
||||
if (key in (Qt.Key.Key_Left, Qt.Key.Key_Right) and
|
||||
not isinstance(focused, GameCard | QLineEdit | QTableWidget | AutoSizeButton) and
|
||||
not self.file_explorer):
|
||||
idx = self._parent.stackedWidget.currentIndex()
|
||||
total = len(self._parent.tabButtons)
|
||||
if key == Qt.Key.Key_Left:
|
||||
@@ -1976,12 +1978,6 @@ class InputManager(QObject):
|
||||
self.dpad_moved.emit(dpad_code, dpad_value, now)
|
||||
return True
|
||||
|
||||
# Launch/stop game on detail page
|
||||
if self._parent.currentDetailPage and key in (Qt.Key.Key_Return, Qt.Key.Key_Enter):
|
||||
if self._parent.current_exec_line:
|
||||
self._parent.toggleGame(self._parent.current_exec_line, None)
|
||||
return True
|
||||
|
||||
# Context menu for GameCard
|
||||
if isinstance(focused, GameCard):
|
||||
if key == Qt.Key.Key_F10 and modifiers & Qt.KeyboardModifier.ShiftModifier:
|
||||
@@ -1991,6 +1987,18 @@ class InputManager(QObject):
|
||||
|
||||
# General actions: Activate, Back, Add
|
||||
if key in (Qt.Key.Key_Return, Qt.Key.Key_Enter):
|
||||
# Special handling for table widgets with checkboxes
|
||||
if isinstance(focused, QTableWidget):
|
||||
current_row = focused.currentRow()
|
||||
current_col = focused.currentColumn()
|
||||
if current_row >= 0 and current_col >= 0:
|
||||
# Check if the cell contains a checkbox
|
||||
item = focused.item(current_row, current_col)
|
||||
if item and (item.flags() & Qt.ItemFlag.ItemIsUserCheckable):
|
||||
# Toggle the checkbox state
|
||||
new_state = Qt.CheckState.Checked if item.checkState() == Qt.CheckState.Unchecked else Qt.CheckState.Unchecked
|
||||
item.setCheckState(new_state)
|
||||
return True
|
||||
self._parent.activateFocusedWidget()
|
||||
return True
|
||||
elif key in (Qt.Key.Key_Escape, Qt.Key.Key_Backspace):
|
||||
|
||||
@@ -1199,7 +1199,7 @@ class MainWindow(QMainWindow):
|
||||
self.progress_bar.setRange(0, 0) # Indeterminate
|
||||
self.update_status_message.emit(_("Refreshing game library..."), 0)
|
||||
|
||||
# Clear the game card cache to force reload of custom data
|
||||
# Clear the game card cache and layout to force reload of custom data
|
||||
if hasattr(self, 'game_library_manager') and self.game_library_manager:
|
||||
# Clear the cache to ensure custom data is reloaded
|
||||
self.game_library_manager.game_card_cache.clear()
|
||||
@@ -1209,6 +1209,19 @@ class MainWindow(QMainWindow):
|
||||
# Mark for full rebuild of search indices
|
||||
self.game_library_manager.dirty = True # Force full update
|
||||
|
||||
# Also clear the layout to ensure old widgets are removed
|
||||
if (hasattr(self.game_library_manager, 'gamesListLayout') and
|
||||
self.game_library_manager.gamesListLayout and
|
||||
hasattr(self.game_library_manager, 'gamesListWidget') and
|
||||
self.game_library_manager.gamesListWidget):
|
||||
# Remove all widgets from the layout
|
||||
self.game_library_manager.clear_layout(self.game_library_manager.gamesListLayout)
|
||||
|
||||
# Force layout update to ensure UI changes are visible
|
||||
self.game_library_manager.gamesListWidget.updateGeometry()
|
||||
if hasattr(self.game_library_manager, 'gamesListLayout'):
|
||||
self.game_library_manager.gamesListLayout.update()
|
||||
|
||||
# Reload games using the existing loadGames functionality
|
||||
# Use a small delay to allow UI to update before starting the refresh
|
||||
QTimer.singleShot(50, lambda: self.loadGames())
|
||||
|
||||
Reference in New Issue
Block a user