Mods
This commit is contained in:
parent
d989ac45a8
commit
0579aa140d
|
@ -37,7 +37,9 @@ class Ant:
|
|||
self.status = data["status"]
|
||||
self.hits = data["hits"]
|
||||
self.triumph = data["triumph"]
|
||||
self.color = tuple(data["color"])
|
||||
|
||||
c = data["color"]
|
||||
self.color = (c[0], c[1], c[2])
|
||||
|
||||
def get_name(self) -> str:
|
||||
return self.name or "Nameless"
|
||||
|
|
|
@ -4,7 +4,7 @@ import random
|
|||
from pathlib import Path
|
||||
|
||||
from PySide6.QtCore import Qt # type: ignore
|
||||
from PySide6.QtWidgets import QHBoxLayout
|
||||
from PySide6.QtWidgets import QHBoxLayout # type: ignore
|
||||
from PySide6.QtWidgets import QVBoxLayout
|
||||
from PySide6.QtWidgets import QLabel
|
||||
from PySide6.QtGui import QPixmap # type: ignore
|
||||
|
@ -62,7 +62,7 @@ class Game:
|
|||
@staticmethod
|
||||
def make_right_container(title: str, message: str) -> QVBoxLayout:
|
||||
container = QVBoxLayout()
|
||||
container.setAlignment(Qt.AlignTop)
|
||||
container.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
title_label = QLabel(title)
|
||||
title_label.setStyleSheet("font-weight: bold;")
|
||||
message_label = QLabel(message)
|
||||
|
@ -76,13 +76,20 @@ class Game:
|
|||
pixmap = QPixmap(str(image_path))
|
||||
|
||||
scaled_pixmap = pixmap.scaled(
|
||||
Config.image_size, pixmap.height(), Qt.KeepAspectRatio, Qt.SmoothTransformation
|
||||
Config.image_size,
|
||||
pixmap.height(),
|
||||
Qt.AspectRatioMode.KeepAspectRatio,
|
||||
Qt.TransformationMode.SmoothTransformation,
|
||||
)
|
||||
|
||||
image_label.setPixmap(scaled_pixmap)
|
||||
image_label.setFixedSize(scaled_pixmap.size()) # Set QLabel size to match QPixmap size
|
||||
image_label.setFixedSize(
|
||||
scaled_pixmap.size()
|
||||
) # Set QLabel size to match QPixmap 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};")
|
||||
image_label.setStyleSheet(
|
||||
f"bpyside6. how do i make this start at the top. top alignedorder: 2px solid {border_rgb};"
|
||||
)
|
||||
return image_label
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -3,13 +3,13 @@ from __future__ import annotations
|
|||
from PySide6.QtWidgets import QApplication # type: ignore
|
||||
from PySide6.QtWidgets import QMainWindow
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from PySide6.QtWidgets import QGraphicsView
|
||||
from PySide6.QtWidgets import QGraphicsScene
|
||||
from PySide6.QtWidgets import QVBoxLayout
|
||||
from PySide6.QtWidgets import QPushButton
|
||||
from PySide6.QtWidgets import QHBoxLayout
|
||||
from PySide6.QtWidgets import QScrollArea
|
||||
from PySide6.QtGui import QIcon
|
||||
from PySide6.QtWidgets import QLayout
|
||||
from PySide6.QtGui import QIcon # type: ignore
|
||||
from PySide6.QtCore import Qt # type: ignore
|
||||
|
||||
from .config import Config
|
||||
|
@ -18,8 +18,8 @@ from .config import Config
|
|||
class Window:
|
||||
app: QApplication
|
||||
window: QMainWindow
|
||||
root: QHBoxLayout
|
||||
view: QGraphicsView
|
||||
root: QVBoxLayout
|
||||
view: QVBoxLayout
|
||||
view_scene: QGraphicsScene
|
||||
|
||||
@staticmethod
|
||||
|
@ -34,11 +34,10 @@ class Window:
|
|||
Window.window = QMainWindow()
|
||||
Window.window.setWindowTitle(Config.title)
|
||||
Window.window.resize(Config.width, Config.height)
|
||||
Window.root = QHBoxLayout()
|
||||
central_widget = QWidget()
|
||||
Window.root = QVBoxLayout()
|
||||
central_widget.setLayout(Window.root)
|
||||
Window.root.setAlignment(Qt.AlignTop)
|
||||
Window.root.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
Window.window.setCentralWidget(central_widget)
|
||||
Window.window.setWindowIcon(QIcon(str(Config.icon_path)))
|
||||
|
||||
|
@ -74,7 +73,7 @@ class Window:
|
|||
Window.view = QVBoxLayout()
|
||||
parent.addLayout(Window.view)
|
||||
|
||||
Window.view.setAlignment(Qt.AlignTop)
|
||||
Window.view.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
scroll_area.setWidget(container)
|
||||
Window.root.addWidget(scroll_area)
|
||||
|
||||
|
@ -100,7 +99,7 @@ class Window:
|
|||
Window.app.quit()
|
||||
|
||||
@staticmethod
|
||||
def delete_layout(layout):
|
||||
def delete_layout(layout: QLayout) -> None:
|
||||
while layout.count():
|
||||
item = layout.takeAt(0)
|
||||
if item.widget():
|
||||
|
|
Loading…
Reference in New Issue