chore: drop all pyright ignore
All checks were successful
Code check / Check code (push) Successful in 1m22s
All checks were successful
Code check / Check code (push) Successful in 1m22s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from typing import Any, cast
|
||||
from PySide6.QtCore import QPropertyAnimation, QByteArray, QEasingCurve, QAbstractAnimation, QParallelAnimationGroup, QRect, Qt, QPoint
|
||||
from PySide6.QtGui import QPainter, QPen, QColor, QConicalGradient, QBrush
|
||||
from PySide6.QtWidgets import QWidget, QGraphicsOpacityEffect
|
||||
@@ -256,7 +257,7 @@ class DetailPageAnimations:
|
||||
self.animations[detail_page] = animation
|
||||
def restore_effect():
|
||||
try:
|
||||
detail_page.setGraphicsEffect(original_effect) # type: ignore
|
||||
detail_page.setGraphicsEffect(cast(Any, original_effect))
|
||||
except RuntimeError:
|
||||
logger.warning("Original effect already deleted")
|
||||
animation.finished.connect(restore_effect)
|
||||
@@ -338,7 +339,7 @@ class DetailPageAnimations:
|
||||
self.animations[detail_page] = animation
|
||||
def restore_and_cleanup():
|
||||
try:
|
||||
detail_page.setGraphicsEffect(original_effect) # type: ignore
|
||||
detail_page.setGraphicsEffect(cast(Any, original_effect))
|
||||
except RuntimeError:
|
||||
logger.debug("Original effect already deleted")
|
||||
cleanup_callback()
|
||||
|
||||
@@ -104,15 +104,14 @@ def main():
|
||||
def restore_window():
|
||||
try:
|
||||
if msg.startswith("show"):
|
||||
if hasattr(window, "restore_from_tray"):
|
||||
window.restore_from_tray() # type: ignore[attr-defined]
|
||||
else:
|
||||
window.showNormal()
|
||||
window.raise_()
|
||||
window.activateWindow()
|
||||
window.setWindowState(
|
||||
window.windowState() & ~Qt.WindowState.WindowMinimized | Qt.WindowState.WindowActive
|
||||
)
|
||||
# Ensure the window is visible and not minimized
|
||||
window.setWindowState(window.windowState() & ~Qt.WindowState.WindowMinimized)
|
||||
window.show()
|
||||
window.raise_()
|
||||
window.activateWindow()
|
||||
|
||||
# Ensure window is in active state for systems with strict focus policies
|
||||
window.setWindowState(window.windowState() | Qt.WindowState.WindowActive)
|
||||
|
||||
if ":fullscreen" in msg:
|
||||
logger.info("Switching to fullscreen via IPC")
|
||||
|
||||
@@ -407,7 +407,10 @@ class GameCard(QFrame):
|
||||
parent = self.parent()
|
||||
while parent:
|
||||
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
|
||||
parent = parent.parent()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import time
|
||||
import threading
|
||||
import os
|
||||
import math
|
||||
from typing import Protocol, cast
|
||||
from typing import Protocol, cast, Any
|
||||
from evdev import InputDevice, InputEvent, UInput, ecodes, list_devices, ff
|
||||
from enum import Enum
|
||||
from pyudev import Context, Monitor, Device, Devices
|
||||
@@ -264,7 +264,7 @@ class InputManager(QObject):
|
||||
return
|
||||
current_row = sorted_rows[current_row_idx][1]
|
||||
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
|
||||
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
|
||||
|
||||
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:
|
||||
self.min_value = absinfo.min
|
||||
self.max_value = absinfo.max
|
||||
|
||||
@@ -6,14 +6,13 @@ import subprocess
|
||||
import sys
|
||||
import psutil
|
||||
import re
|
||||
|
||||
from portprotonqt.logger import get_logger
|
||||
from portprotonqt.dialogs import AddGameDialog, FileExplorer, WinetricksDialog, ExeSettingsDialog
|
||||
from portprotonqt.game_card import GameCard
|
||||
from portprotonqt.animations import DetailPageAnimations
|
||||
from portprotonqt.custom_widgets import ClickableLabel, AutoSizeButton, NavLabel, FlowLayout
|
||||
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.system_overlay import SystemOverlay
|
||||
from portprotonqt.input_manager import GamepadType
|
||||
@@ -153,7 +152,7 @@ class MainWindow(QMainWindow):
|
||||
headerLayout.setContentsMargins(0, 0, 0, 0)
|
||||
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.dpad_moved.connect(self.updateControlHints)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user