This commit is contained in:
Auric Vente 2024-07-20 02:56:05 -06:00
parent b8daed8a8a
commit 869a108360
2 changed files with 18 additions and 13 deletions

View File

@ -8,8 +8,8 @@ from PySide6.QtWidgets import QHBoxLayout # type: ignore
from PySide6.QtWidgets import QVBoxLayout
from PySide6.QtWidgets import QLabel
from PySide6.QtWidgets import QWidget
from PySide6.QtGui import QKeyEvent
from PySide6.QtGui import QPixmap # type: ignore
from PySide6.QtGui import QKeyEvent # type: ignore
from PySide6.QtGui import QPixmap
from PySide6.QtCore import QTimer
from wonderwords import RandomSentence # type: ignore
@ -79,6 +79,7 @@ class Game:
def add_view_container(container: QHBoxLayout) -> None:
root = QWidget()
root.setContentsMargins(0, 0, 0, 0)
container.setContentsMargins(0, 0, 0, 0)
root.setLayout(container)
Window.view.insertWidget(0, root)
@ -286,8 +287,8 @@ class Game:
layout2 = widget.layout()
for i in range(layout2.count()):
wid = layout2.itemAt(i).widget()
for j in range(layout2.count()):
wid = layout2.itemAt(j).widget()
if not wid:
continue
@ -297,9 +298,7 @@ class Game:
if not name:
continue
if name == "view_title":
text.append(wid.text().lower())
elif name == "view_message":
if (name == "view_title") or (name == "view_message"):
text.append(wid.text().lower())
return text
return text

View File

@ -20,6 +20,7 @@ from PySide6.QtWidgets import QLineEdit
from PySide6.QtGui import QFontDatabase # type: ignore
from PySide6.QtGui import QMouseEvent
from PySide6.QtGui import QIcon
from PySide6.QtGui import QKeyEvent
from PySide6.QtCore import Qt # type: ignore
from PySide6.QtCore import Signal
from PySide6.QtCore import QUrl
@ -40,6 +41,14 @@ class SpecialButton(QPushButton): # type: ignore
super().mousePressEvent(e)
class FilterLineEdit(QLineEdit): # type: ignore
def keyPressEvent(self, e: QKeyEvent) -> None:
if e.key() == Qt.Key_Escape:
self.clear()
else:
super().keyPressEvent(e)
class Window:
app: QApplication
window: QMainWindow
@ -207,8 +216,7 @@ class Window:
Window.speed.setCurrentIndex(1)
Window.speed.currentIndexChanged.connect(Game.update_speed)
Window.filter = QLineEdit()
Window.filter = FilterLineEdit()
Window.filter.setToolTip("Filter the updates\nClick to scroll to the top")
Window.filter.setFixedWidth(120)
Window.filter.setPlaceholderText("Filter")
@ -312,9 +320,7 @@ class Window:
container = QHBoxLayout()
Window.info = SpecialButton("---")
Window.info.setToolTip(
"Click to scroll to the bottom or top"
)
Window.info.setToolTip("Click to scroll to the bottom or top")
Window.info.clicked.connect(Window.toggle_scroll)
Window.info.setMinimumSize(35, 35)