Mods
This commit is contained in:
parent
b8daed8a8a
commit
869a108360
|
@ -8,8 +8,8 @@ from PySide6.QtWidgets import QHBoxLayout # type: ignore
|
||||||
from PySide6.QtWidgets import QVBoxLayout
|
from PySide6.QtWidgets import QVBoxLayout
|
||||||
from PySide6.QtWidgets import QLabel
|
from PySide6.QtWidgets import QLabel
|
||||||
from PySide6.QtWidgets import QWidget
|
from PySide6.QtWidgets import QWidget
|
||||||
from PySide6.QtGui import QKeyEvent
|
from PySide6.QtGui import QKeyEvent # type: ignore
|
||||||
from PySide6.QtGui import QPixmap # type: ignore
|
from PySide6.QtGui import QPixmap
|
||||||
from PySide6.QtCore import QTimer
|
from PySide6.QtCore import QTimer
|
||||||
|
|
||||||
from wonderwords import RandomSentence # type: ignore
|
from wonderwords import RandomSentence # type: ignore
|
||||||
|
@ -79,6 +79,7 @@ class Game:
|
||||||
def add_view_container(container: QHBoxLayout) -> None:
|
def add_view_container(container: QHBoxLayout) -> None:
|
||||||
root = QWidget()
|
root = QWidget()
|
||||||
root.setContentsMargins(0, 0, 0, 0)
|
root.setContentsMargins(0, 0, 0, 0)
|
||||||
|
container.setContentsMargins(0, 0, 0, 0)
|
||||||
root.setLayout(container)
|
root.setLayout(container)
|
||||||
Window.view.insertWidget(0, root)
|
Window.view.insertWidget(0, root)
|
||||||
|
|
||||||
|
@ -286,8 +287,8 @@ class Game:
|
||||||
|
|
||||||
layout2 = widget.layout()
|
layout2 = widget.layout()
|
||||||
|
|
||||||
for i in range(layout2.count()):
|
for j in range(layout2.count()):
|
||||||
wid = layout2.itemAt(i).widget()
|
wid = layout2.itemAt(j).widget()
|
||||||
|
|
||||||
if not wid:
|
if not wid:
|
||||||
continue
|
continue
|
||||||
|
@ -297,9 +298,7 @@ class Game:
|
||||||
if not name:
|
if not name:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if name == "view_title":
|
if (name == "view_title") or (name == "view_message"):
|
||||||
text.append(wid.text().lower())
|
|
||||||
elif name == "view_message":
|
|
||||||
text.append(wid.text().lower())
|
text.append(wid.text().lower())
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
|
@ -20,6 +20,7 @@ from PySide6.QtWidgets import QLineEdit
|
||||||
from PySide6.QtGui import QFontDatabase # type: ignore
|
from PySide6.QtGui import QFontDatabase # type: ignore
|
||||||
from PySide6.QtGui import QMouseEvent
|
from PySide6.QtGui import QMouseEvent
|
||||||
from PySide6.QtGui import QIcon
|
from PySide6.QtGui import QIcon
|
||||||
|
from PySide6.QtGui import QKeyEvent
|
||||||
from PySide6.QtCore import Qt # type: ignore
|
from PySide6.QtCore import Qt # type: ignore
|
||||||
from PySide6.QtCore import Signal
|
from PySide6.QtCore import Signal
|
||||||
from PySide6.QtCore import QUrl
|
from PySide6.QtCore import QUrl
|
||||||
|
@ -40,6 +41,14 @@ class SpecialButton(QPushButton): # type: ignore
|
||||||
super().mousePressEvent(e)
|
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:
|
class Window:
|
||||||
app: QApplication
|
app: QApplication
|
||||||
window: QMainWindow
|
window: QMainWindow
|
||||||
|
@ -207,8 +216,7 @@ class Window:
|
||||||
Window.speed.setCurrentIndex(1)
|
Window.speed.setCurrentIndex(1)
|
||||||
Window.speed.currentIndexChanged.connect(Game.update_speed)
|
Window.speed.currentIndexChanged.connect(Game.update_speed)
|
||||||
|
|
||||||
|
Window.filter = FilterLineEdit()
|
||||||
Window.filter = QLineEdit()
|
|
||||||
Window.filter.setToolTip("Filter the updates\nClick to scroll to the top")
|
Window.filter.setToolTip("Filter the updates\nClick to scroll to the top")
|
||||||
Window.filter.setFixedWidth(120)
|
Window.filter.setFixedWidth(120)
|
||||||
Window.filter.setPlaceholderText("Filter")
|
Window.filter.setPlaceholderText("Filter")
|
||||||
|
@ -312,9 +320,7 @@ class Window:
|
||||||
container = QHBoxLayout()
|
container = QHBoxLayout()
|
||||||
Window.info = SpecialButton("---")
|
Window.info = SpecialButton("---")
|
||||||
|
|
||||||
Window.info.setToolTip(
|
Window.info.setToolTip("Click to scroll to the bottom or top")
|
||||||
"Click to scroll to the bottom or top"
|
|
||||||
)
|
|
||||||
|
|
||||||
Window.info.clicked.connect(Window.toggle_scroll)
|
Window.info.clicked.connect(Window.toggle_scroll)
|
||||||
Window.info.setMinimumSize(35, 35)
|
Window.info.setMinimumSize(35, 35)
|
||||||
|
|
Loading…
Reference in New Issue