chore(keyboard): drop connect_keyboard_to_lineedit
All checks were successful
Code check / Check code (pull_request) Successful in 1m17s
All checks were successful
Code check / Check code (pull_request) Successful in 1m17s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -17,7 +17,7 @@ from portprotonqt.logger import get_logger
|
|||||||
from portprotonqt.theme_manager import ThemeManager
|
from portprotonqt.theme_manager import ThemeManager
|
||||||
from portprotonqt.custom_widgets import AutoSizeButton
|
from portprotonqt.custom_widgets import AutoSizeButton
|
||||||
from portprotonqt.downloader import Downloader
|
from portprotonqt.downloader import Downloader
|
||||||
from portprotonqt.virtual_keyboard import VirtualKeyboard, connect_keyboard_to_lineedit
|
from portprotonqt.virtual_keyboard import VirtualKeyboard
|
||||||
from portprotonqt.preloader import Preloader
|
from portprotonqt.preloader import Preloader
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
@@ -833,11 +833,6 @@ class AddGameDialog(QDialog):
|
|||||||
self.keyboard.setMinimumWidth(574)
|
self.keyboard.setMinimumWidth(574)
|
||||||
self.keyboard.setMinimumHeight(220)
|
self.keyboard.setMinimumHeight(220)
|
||||||
|
|
||||||
# Подключаем клавиатуру к полям ввода
|
|
||||||
connect_keyboard_to_lineedit(self.keyboard, self.nameEdit)
|
|
||||||
connect_keyboard_to_lineedit(self.keyboard, self.exeEdit)
|
|
||||||
connect_keyboard_to_lineedit(self.keyboard, self.coverEdit)
|
|
||||||
|
|
||||||
def show_keyboard_for_widget(self, widget):
|
def show_keyboard_for_widget(self, widget):
|
||||||
"""Показывает клавиатуру для указанного виджета"""
|
"""Показывает клавиатуру для указанного виджета"""
|
||||||
if not widget or not widget.isVisible():
|
if not widget or not widget.isVisible():
|
||||||
|
@@ -35,7 +35,7 @@ from portprotonqt.howlongtobeat_api import HowLongToBeat
|
|||||||
from portprotonqt.downloader import Downloader
|
from portprotonqt.downloader import Downloader
|
||||||
from portprotonqt.tray_manager import TrayManager
|
from portprotonqt.tray_manager import TrayManager
|
||||||
from portprotonqt.game_library_manager import GameLibraryManager
|
from portprotonqt.game_library_manager import GameLibraryManager
|
||||||
from portprotonqt.virtual_keyboard import VirtualKeyboard, connect_keyboard_to_lineedit
|
from portprotonqt.virtual_keyboard import VirtualKeyboard
|
||||||
|
|
||||||
from PySide6.QtWidgets import (QLineEdit, QMainWindow, QStatusBar, QWidget, QVBoxLayout, QLabel, QHBoxLayout, QStackedWidget, QComboBox,
|
from PySide6.QtWidgets import (QLineEdit, QMainWindow, QStatusBar, QWidget, QVBoxLayout, QLabel, QHBoxLayout, QStackedWidget, QComboBox,
|
||||||
QDialog, QFormLayout, QFrame, QGraphicsDropShadowEffect, QMessageBox, QApplication, QPushButton, QProgressBar, QCheckBox, QSizePolicy, QGridLayout)
|
QDialog, QFormLayout, QFrame, QGraphicsDropShadowEffect, QMessageBox, QApplication, QPushButton, QProgressBar, QCheckBox, QSizePolicy, QGridLayout)
|
||||||
@@ -212,7 +212,6 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
self.keyboard = VirtualKeyboard(self)
|
self.keyboard = VirtualKeyboard(self)
|
||||||
mainLayout.addWidget(self.keyboard)
|
mainLayout.addWidget(self.keyboard)
|
||||||
connect_keyboard_to_lineedit(self.keyboard, self.searchEdit)
|
|
||||||
|
|
||||||
self.detail_animations = DetailPageAnimations(self, self.theme)
|
self.detail_animations = DetailPageAnimations(self, self.theme)
|
||||||
QTimer.singleShot(0, self.loadGames)
|
QTimer.singleShot(0, self.loadGames)
|
||||||
|
@@ -540,18 +540,3 @@ class VirtualKeyboard(QFrame):
|
|||||||
if item and item.widget() and item.widget().isEnabled():
|
if item and item.widget() and item.widget().isEnabled():
|
||||||
return cast(QPushButton, item.widget())
|
return cast(QPushButton, item.widget())
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def connect_keyboard_to_lineedit(keyboard: VirtualKeyboard, line_edit: QLineEdit):
|
|
||||||
"""Подключаем виртуальную клавиатуру к QLineEdit"""
|
|
||||||
original_mouse_press = line_edit.mousePressEvent
|
|
||||||
|
|
||||||
def custom_mouse_press(event):
|
|
||||||
# Сначала вызываем оригинальный обработчик
|
|
||||||
if original_mouse_press:
|
|
||||||
original_mouse_press(event)
|
|
||||||
# Затем показываем клавиатуру
|
|
||||||
keyboard.show_for_widget(line_edit)
|
|
||||||
line_edit.setFocus()
|
|
||||||
|
|
||||||
line_edit.mousePressEvent = custom_mouse_press
|
|
||||||
line_edit.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
|
||||||
|
Reference in New Issue
Block a user