chore: drop all pyright ignore

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-11-26 17:34:24 +05:00
parent 0b36e73bce
commit 99a963d60c
5 changed files with 20 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
from typing import Any, cast
from PySide6.QtCore import QPropertyAnimation, QByteArray, QEasingCurve, QAbstractAnimation, QParallelAnimationGroup, QRect, Qt, QPoint from PySide6.QtCore import QPropertyAnimation, QByteArray, QEasingCurve, QAbstractAnimation, QParallelAnimationGroup, QRect, Qt, QPoint
from PySide6.QtGui import QPainter, QPen, QColor, QConicalGradient, QBrush from PySide6.QtGui import QPainter, QPen, QColor, QConicalGradient, QBrush
from PySide6.QtWidgets import QWidget, QGraphicsOpacityEffect from PySide6.QtWidgets import QWidget, QGraphicsOpacityEffect
@@ -256,7 +257,7 @@ class DetailPageAnimations:
self.animations[detail_page] = animation self.animations[detail_page] = animation
def restore_effect(): def restore_effect():
try: try:
detail_page.setGraphicsEffect(original_effect) # type: ignore detail_page.setGraphicsEffect(cast(Any, original_effect))
except RuntimeError: except RuntimeError:
logger.warning("Original effect already deleted") logger.warning("Original effect already deleted")
animation.finished.connect(restore_effect) animation.finished.connect(restore_effect)
@@ -338,7 +339,7 @@ class DetailPageAnimations:
self.animations[detail_page] = animation self.animations[detail_page] = animation
def restore_and_cleanup(): def restore_and_cleanup():
try: try:
detail_page.setGraphicsEffect(original_effect) # type: ignore detail_page.setGraphicsEffect(cast(Any, original_effect))
except RuntimeError: except RuntimeError:
logger.debug("Original effect already deleted") logger.debug("Original effect already deleted")
cleanup_callback() cleanup_callback()

View File

@@ -104,15 +104,14 @@ def main():
def restore_window(): def restore_window():
try: try:
if msg.startswith("show"): if msg.startswith("show"):
if hasattr(window, "restore_from_tray"): # Ensure the window is visible and not minimized
window.restore_from_tray() # type: ignore[attr-defined] window.setWindowState(window.windowState() & ~Qt.WindowState.WindowMinimized)
else: window.show()
window.showNormal() window.raise_()
window.raise_() window.activateWindow()
window.activateWindow()
window.setWindowState( # Ensure window is in active state for systems with strict focus policies
window.windowState() & ~Qt.WindowState.WindowMinimized | Qt.WindowState.WindowActive window.setWindowState(window.windowState() | Qt.WindowState.WindowActive)
)
if ":fullscreen" in msg: if ":fullscreen" in msg:
logger.info("Switching to fullscreen via IPC") logger.info("Switching to fullscreen via IPC")

View File

@@ -407,7 +407,10 @@ class GameCard(QFrame):
parent = self.parent() parent = self.parent()
while parent: while parent:
if hasattr(parent, 'game_library_manager'): if hasattr(parent, 'game_library_manager'):
QTimer.singleShot(0, parent.game_library_manager.update_game_grid) # type: ignore[attr-defined] # Access using getattr with default to avoid Ruff B009 warning
manager = getattr(parent, 'game_library_manager', None)
if manager is not None:
QTimer.singleShot(0, manager.update_game_grid)
break break
parent = parent.parent() parent = parent.parent()

View File

@@ -2,7 +2,7 @@ import time
import threading import threading
import os import os
import math import math
from typing import Protocol, cast from typing import Protocol, cast, Any
from evdev import InputDevice, InputEvent, UInput, ecodes, list_devices, ff from evdev import InputDevice, InputEvent, UInput, ecodes, list_devices, ff
from enum import Enum from enum import Enum
from pyudev import Context, Monitor, Device, Devices from pyudev import Context, Monitor, Device, Devices
@@ -264,7 +264,7 @@ class InputManager(QObject):
return return
current_row = sorted_rows[current_row_idx][1] current_row = sorted_rows[current_row_idx][1]
focused_x = focused.pos().x() + focused.width() / 2 focused_x = focused.pos().x() + focused.width() / 2
current_col_idx = min(range(len(current_row)), key=lambda i: abs((current_row[i].pos().x() + current_row[i].width() / 2) - focused_x), default=0) # type: ignore current_col_idx = min(range(len(current_row)), key=lambda i: abs((current_row[i].pos().x() + current_row[i].width() / 2) - focused_x), default=0)
# Add null checks before using current_row_idx and current_col_idx # Add null checks before using current_row_idx and current_col_idx
if current_row_idx is None or current_col_idx is None or current_row_idx >= len(sorted_rows): if current_row_idx is None or current_col_idx is None or current_row_idx >= len(sorted_rows):
@@ -2287,7 +2287,7 @@ class InputManager(QObject):
return return
abs_axes = caps[ecodes.EV_ABS] abs_axes = caps[ecodes.EV_ABS]
for code, absinfo in abs_axes: # type: ignore for code, absinfo in cast(Any, abs_axes):
if code == ecodes.ABS_X: if code == ecodes.ABS_X:
self.min_value = absinfo.min self.min_value = absinfo.min
self.max_value = absinfo.max self.max_value = absinfo.max

View File

@@ -6,14 +6,13 @@ import subprocess
import sys import sys
import psutil import psutil
import re import re
from portprotonqt.logger import get_logger from portprotonqt.logger import get_logger
from portprotonqt.dialogs import AddGameDialog, FileExplorer, WinetricksDialog, ExeSettingsDialog from portprotonqt.dialogs import AddGameDialog, FileExplorer, WinetricksDialog, ExeSettingsDialog
from portprotonqt.game_card import GameCard from portprotonqt.game_card import GameCard
from portprotonqt.animations import DetailPageAnimations from portprotonqt.animations import DetailPageAnimations
from portprotonqt.custom_widgets import ClickableLabel, AutoSizeButton, NavLabel, FlowLayout from portprotonqt.custom_widgets import ClickableLabel, AutoSizeButton, NavLabel, FlowLayout
from portprotonqt.portproton_api import PortProtonAPI from portprotonqt.portproton_api import PortProtonAPI
from portprotonqt.input_manager import InputManager from portprotonqt.input_manager import InputManager, MainWindowProtocol
from portprotonqt.context_menu_manager import ContextMenuManager, CustomLineEdit from portprotonqt.context_menu_manager import ContextMenuManager, CustomLineEdit
from portprotonqt.system_overlay import SystemOverlay from portprotonqt.system_overlay import SystemOverlay
from portprotonqt.input_manager import GamepadType from portprotonqt.input_manager import GamepadType
@@ -153,7 +152,7 @@ class MainWindow(QMainWindow):
headerLayout.setContentsMargins(0, 0, 0, 0) headerLayout.setContentsMargins(0, 0, 0, 0)
headerLayout.addStretch() headerLayout.addStretch()
self.input_manager = InputManager(self) # type: ignore self.input_manager = InputManager(cast(MainWindowProtocol, self))
self.input_manager.button_event.connect(self.updateControlHints) self.input_manager.button_event.connect(self.updateControlHints)
self.input_manager.dpad_moved.connect(self.updateControlHints) self.input_manager.dpad_moved.connect(self.updateControlHints)