fix: resolve Pyright type errors in SystemOverlay class
All checks were successful
Code and build check / Check code (push) Successful in 1m26s
Code and build check / Build with uv (push) Successful in 49s

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-06-13 17:43:49 +05:00
parent e9ecb466b2
commit f105af01ef

View File

@ -1,6 +1,5 @@
import subprocess
from PySide6.QtWidgets import QDialog, QVBoxLayout, QPushButton, QMessageBox
from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QDialog, QVBoxLayout, QPushButton, QMessageBox, QApplication, QWidget
from PySide6.QtCore import Qt
from portprotonqt.logger import get_logger
import os
@ -94,19 +93,21 @@ class SystemOverlay(QDialog):
layout.addWidget(cancel_button)
def showEvent(self, event):
"""Переопределяем showEvent для центрирования окна и установки фокуса"""
"""Override showEvent to center window and set focus."""
super().showEvent(event)
# Центрируем окно относительно родителя или экрана
if self.parent():
self.move(self.parent().geometry().center() - self.rect().center())
# Center window relative to parent or screen
parent = self.parent()
if isinstance(parent, QWidget) and parent.isVisible():
self.move(parent.geometry().center() - self.rect().center())
else:
screen_geometry = QApplication.primaryScreen().availableGeometry()
self.move(screen_geometry.center() - self.rect().center())
# Устанавливаем фокус на первый элемент
self.setFocus()
self.findChild(QPushButton).setFocus()
# Set focus on first button
button = self.findChild(QPushButton)
if button is not None:
button.setFocus()
def reboot(self):
try: