Mods
This commit is contained in:
@@ -7,6 +7,7 @@ from PySide6.QtCore import Qt # type: ignore
|
||||
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 QPixmap # type: ignore
|
||||
from PySide6.QtCore import QTimer
|
||||
|
||||
@@ -34,7 +35,7 @@ class Game:
|
||||
|
||||
container.addWidget(image_label)
|
||||
container.addSpacing(Config.space_1)
|
||||
container.addLayout(right_container)
|
||||
container.addWidget(right_container)
|
||||
Game.add_view_container(container)
|
||||
|
||||
@staticmethod
|
||||
@@ -45,7 +46,7 @@ class Game:
|
||||
|
||||
container.addWidget(image_label)
|
||||
container.addSpacing(Config.space_1)
|
||||
container.addLayout(right_container)
|
||||
container.addWidget(right_container)
|
||||
Game.add_view_container(container)
|
||||
|
||||
@staticmethod
|
||||
@@ -60,15 +61,25 @@ class Game:
|
||||
Window.delete_layout(item.layout())
|
||||
|
||||
@staticmethod
|
||||
def make_right_container(title: str, message: str) -> QVBoxLayout:
|
||||
def make_right_container(title: str, message: str) -> QWidget:
|
||||
root = QWidget()
|
||||
container = QVBoxLayout()
|
||||
container.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
title_label = QLabel(title)
|
||||
title_label.setStyleSheet("font-weight: bold;")
|
||||
title_label.setWordWrap(True)
|
||||
Window.expand(title_label)
|
||||
|
||||
message_label = QLabel(message)
|
||||
message_label.setWordWrap(True)
|
||||
Window.expand(message_label)
|
||||
|
||||
container.addWidget(title_label)
|
||||
container.addWidget(message_label)
|
||||
return container
|
||||
root.setLayout(container)
|
||||
|
||||
return root
|
||||
|
||||
@staticmethod
|
||||
def get_image(image_path: Path, border_color: tuple[int, int, int]) -> QLabel:
|
||||
@@ -83,13 +94,15 @@ class Game:
|
||||
)
|
||||
|
||||
image_label.setPixmap(scaled_pixmap)
|
||||
image_label.setFixedSize(
|
||||
scaled_pixmap.size()
|
||||
) # Set QLabel size to match QPixmap size
|
||||
|
||||
image_label.setFixedSize(scaled_pixmap.size())
|
||||
|
||||
border_rgb = Utils.get_rgb(border_color)
|
||||
|
||||
image_label.setStyleSheet(
|
||||
f"bpyside6. how do i make this start at the top. top alignedorder: 2px solid {border_rgb};"
|
||||
)
|
||||
|
||||
return image_label
|
||||
|
||||
@staticmethod
|
||||
@@ -136,7 +149,20 @@ class Game:
|
||||
|
||||
@staticmethod
|
||||
def start_loop() -> None:
|
||||
interval_ms = Config.loop_delay
|
||||
speed = Window.speed.currentText()
|
||||
|
||||
if speed == "Fast":
|
||||
delay = Config.loop_delay_fast
|
||||
elif speed == "Normal":
|
||||
delay = Config.loop_delay_normal
|
||||
else:
|
||||
delay = Config.loop_delay_slow
|
||||
|
||||
Game.timer = QTimer()
|
||||
Game.timer.timeout.connect(Game.get_status)
|
||||
Game.timer.start(interval_ms)
|
||||
Game.timer.start(delay)
|
||||
|
||||
@staticmethod
|
||||
def update_speed() -> None:
|
||||
Game.timer.stop()
|
||||
Game.start_loop()
|
||||
|
Reference in New Issue
Block a user