From 9ceff213fbbc53e0d8376a7b9c2efb298cf08bac Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Mon, 22 Jul 2024 02:32:11 -0600 Subject: [PATCH] Mods --- cromulant/game.py | 24 +++++++++++++++++++++++- cromulant/window.py | 9 +++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/cromulant/game.py b/cromulant/game.py index b5fc02e..8de92cd 100644 --- a/cromulant/game.py +++ b/cromulant/game.py @@ -7,6 +7,7 @@ from PySide6.QtWidgets import QHBoxLayout # type: ignore from PySide6.QtWidgets import QVBoxLayout from PySide6.QtWidgets import QLabel from PySide6.QtWidgets import QWidget +from PySide6.QtWidgets import QFrame from PySide6.QtGui import QMouseEvent # type: ignore from PySide6.QtGui import QPixmap from PySide6.QtCore import QTimer @@ -60,10 +61,31 @@ class Game: def message(text: str) -> None: root = QWidget() root.setContentsMargins(0, 10, 0, 10) + container = QHBoxLayout() 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) + + 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(right_line) + + container.setSpacing(Config.space_1 * 2) root.setLayout(container) Game.add_item(root) @@ -350,4 +372,4 @@ class Game: @staticmethod def intro() -> None: version = Config.manifest["version"] - Game.message(f"🐜 🐜 Welcome to Cromulant v{version} 🐜 🐜") + Game.message(f"Welcome to Cromulant v{version}") diff --git a/cromulant/window.py b/cromulant/window.py index 90e669d..ac0ec61 100644 --- a/cromulant/window.py +++ b/cromulant/window.py @@ -204,6 +204,11 @@ class Window: border: 1px solid {Config.input_border_color}; }} + QFrame#horizontal_line {{ + background-color: white; + color: white; + }} + """.strip() Window.app.setStyleSheet(style) @@ -283,6 +288,10 @@ class Window: def expand(widget: QWidget) -> None: widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred) + @staticmethod + def expand_2(widget: QWidget) -> None: + widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) + @staticmethod def clear_view() -> None: while Window.view.count():