This commit is contained in:
Auric Vente 2024-07-20 02:16:48 -06:00
parent 77f551a754
commit 53c64c134a
2 changed files with 31 additions and 8 deletions

View File

@ -47,6 +47,10 @@ class Config:
message_box_button_hover_background_color: str = "rgb(66, 66, 66)" message_box_button_hover_background_color: str = "rgb(66, 66, 66)"
message_box_button_hover_text_color: str = "white" message_box_button_hover_text_color: str = "white"
scrollbar_handle_color: str = "rgb(69, 69, 69)" scrollbar_handle_color: str = "rgb(69, 69, 69)"
input_background_color: str = "rgb(111, 111, 111)"
input_text_color: str = "rgb(18, 18, 18)"
input_border_color: str = "rgb(140, 140, 140)"
input_caret_color: str = "rgb(18, 18, 18)"
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:

View File

@ -16,6 +16,7 @@ from PySide6.QtWidgets import QComboBox
from PySide6.QtWidgets import QLayout from PySide6.QtWidgets import QLayout
from PySide6.QtWidgets import QSizePolicy from PySide6.QtWidgets import QSizePolicy
from PySide6.QtWidgets import QMessageBox from PySide6.QtWidgets import QMessageBox
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
@ -162,6 +163,12 @@ class Window:
background: none; background: none;
}} }}
QLineEdit {{
background-color: {Config.input_background_color};
color: {Config.input_text_color};
border: 1px solid {Config.input_border_color};
}}
""".strip() """.strip()
Window.app.setStyleSheet(style) Window.app.setStyleSheet(style)
@ -199,15 +206,17 @@ class Window:
Window.speed.setCurrentIndex(1) Window.speed.setCurrentIndex(1)
Window.speed.currentIndexChanged.connect(Game.update_speed) Window.speed.currentIndexChanged.connect(Game.update_speed)
btn_top = SpecialButton("Top")
btn_top.setToolTip("Scroll to the top\nMiddle Click to scroll to the bottom") filter_input = QLineEdit()
btn_top.clicked.connect(Window.to_top) filter_input.setToolTip("Filter the updates\nClick to scroll to the top")
btn_top.middleClicked.connect(Window.to_bottom) filter_input.setFixedWidth(120)
filter_input.setPlaceholderText("Filter")
filter_input.mousePressEvent = lambda e: Window.to_top()
container.addWidget(btn_hatch) container.addWidget(btn_hatch)
container.addWidget(btn_terminate) container.addWidget(btn_terminate)
container.addWidget(Window.speed) container.addWidget(Window.speed)
container.addWidget(btn_top) container.addWidget(filter_input)
root.setLayout(container) root.setLayout(container)
Window.root.addWidget(root) Window.root.addWidget(root)
@ -285,17 +294,27 @@ class Window:
Window.scroll_area.verticalScrollBar().maximum() Window.scroll_area.verticalScrollBar().maximum()
) )
@staticmethod
def toggle_scroll() -> None:
maxim = Window.scroll_area.verticalScrollBar().maximum()
if Window.scroll_area.verticalScrollBar().value() == maxim:
Window.to_top()
else:
Window.to_bottom()
@staticmethod @staticmethod
def add_footer() -> None: def add_footer() -> None:
root = QWidget() root = QWidget()
root.setContentsMargins(0, 0, 0, 0) root.setContentsMargins(0, 0, 0, 0)
container = QHBoxLayout() container = QHBoxLayout()
Window.info = SpecialButton("---") Window.info = SpecialButton("---")
Window.info.setToolTip( Window.info.setToolTip(
"Scroll to the bottom\nMiddle Click to scroll to the top" "Click to scroll to the bottom or top"
) )
Window.info.clicked.connect(Window.to_bottom)
Window.info.middleClicked.connect(Window.to_top) Window.info.clicked.connect(Window.toggle_scroll)
Window.info.setMinimumSize(35, 35) Window.info.setMinimumSize(35, 35)
container.addWidget(Window.info) container.addWidget(Window.info)
root.setLayout(container) root.setLayout(container)