This commit is contained in:
Auric Vente 2024-07-22 02:32:11 -06:00
parent 34f1412805
commit 9ceff213fb
2 changed files with 32 additions and 1 deletions

View File

@ -7,6 +7,7 @@ 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.QtWidgets import QFrame
from PySide6.QtGui import QMouseEvent # type: ignore from PySide6.QtGui import QMouseEvent # type: ignore
from PySide6.QtGui import QPixmap from PySide6.QtGui import QPixmap
from PySide6.QtCore import QTimer from PySide6.QtCore import QTimer
@ -60,10 +61,31 @@ class Game:
def message(text: str) -> None: def message(text: str) -> None:
root = QWidget() root = QWidget()
root.setContentsMargins(0, 10, 0, 10) root.setContentsMargins(0, 10, 0, 10)
container = QHBoxLayout() container = QHBoxLayout()
container.setAlignment(Qt.AlignCenter) container.setAlignment(Qt.AlignCenter)
left_line = QFrame()
left_line.setFrameShape(QFrame.HLine)
left_line.setFrameShadow(QFrame.Sunken)
left_line.setObjectName("horizontal_line")
left_line.setFixedHeight(2)
Window.expand_2(left_line)
label = QLabel(text) label = QLabel(text)
right_line = QFrame()
right_line.setFrameShape(QFrame.HLine)
right_line.setFrameShadow(QFrame.Sunken)
right_line.setObjectName("horizontal_line")
right_line.setFixedHeight(2)
Window.expand_2(right_line)
container.addWidget(left_line)
container.addWidget(label) container.addWidget(label)
container.addWidget(right_line)
container.setSpacing(Config.space_1 * 2)
root.setLayout(container) root.setLayout(container)
Game.add_item(root) Game.add_item(root)
@ -350,4 +372,4 @@ class Game:
@staticmethod @staticmethod
def intro() -> None: def intro() -> None:
version = Config.manifest["version"] version = Config.manifest["version"]
Game.message(f"🐜 🐜 Welcome to Cromulant v{version} 🐜 🐜") Game.message(f"Welcome to Cromulant v{version}")

View File

@ -204,6 +204,11 @@ class Window:
border: 1px solid {Config.input_border_color}; border: 1px solid {Config.input_border_color};
}} }}
QFrame#horizontal_line {{
background-color: white;
color: white;
}}
""".strip() """.strip()
Window.app.setStyleSheet(style) Window.app.setStyleSheet(style)
@ -283,6 +288,10 @@ class Window:
def expand(widget: QWidget) -> None: def expand(widget: QWidget) -> None:
widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
@staticmethod
def expand_2(widget: QWidget) -> None:
widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
@staticmethod @staticmethod
def clear_view() -> None: def clear_view() -> None:
while Window.view.count(): while Window.view.count():