Mods
This commit is contained in:
		@@ -28,7 +28,6 @@ class Config:
 | 
				
			|||||||
    hatch_burst: int = 3
 | 
					    hatch_burst: int = 3
 | 
				
			||||||
    font_size: int = 20
 | 
					    font_size: int = 20
 | 
				
			||||||
    footer_font_size: int = 18
 | 
					    footer_font_size: int = 18
 | 
				
			||||||
    footer_background_color: str = "#424242"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def prepare() -> None:
 | 
					    def prepare() -> None:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,6 @@ 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 QLabel
 | 
					 | 
				
			||||||
from PySide6.QtGui import QMouseEvent  # type: ignore
 | 
					from PySide6.QtGui import QMouseEvent  # type: ignore
 | 
				
			||||||
from PySide6.QtGui import QIcon
 | 
					from PySide6.QtGui import QIcon
 | 
				
			||||||
from PySide6.QtCore import Qt  # type: ignore
 | 
					from PySide6.QtCore import Qt  # type: ignore
 | 
				
			||||||
@@ -42,7 +41,7 @@ class Window:
 | 
				
			|||||||
    view_scene: QGraphicsScene
 | 
					    view_scene: QGraphicsScene
 | 
				
			||||||
    speed: QComboBox
 | 
					    speed: QComboBox
 | 
				
			||||||
    scroll_area: QScrollArea
 | 
					    scroll_area: QScrollArea
 | 
				
			||||||
    info: QLabel
 | 
					    info: SpecialButton
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def prepare() -> None:
 | 
					    def prepare() -> None:
 | 
				
			||||||
@@ -75,6 +74,9 @@ class Window:
 | 
				
			|||||||
        from .ants import Ants
 | 
					        from .ants import Ants
 | 
				
			||||||
        from .game import Game
 | 
					        from .game import Game
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        root = QWidget()
 | 
				
			||||||
 | 
					        container = QHBoxLayout()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        btn_hatch = SpecialButton("Hatch")
 | 
					        btn_hatch = SpecialButton("Hatch")
 | 
				
			||||||
        btn_hatch.clicked.connect(lambda e: Ants.hatch())
 | 
					        btn_hatch.clicked.connect(lambda e: Ants.hatch())
 | 
				
			||||||
        btn_hatch.middleClicked.connect(lambda: Ants.hatch_burst())
 | 
					        btn_hatch.middleClicked.connect(lambda: Ants.hatch_burst())
 | 
				
			||||||
@@ -88,16 +90,16 @@ 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 = QPushButton("Top")
 | 
					        btn_top = SpecialButton("Top")
 | 
				
			||||||
        btn_top.clicked.connect(Window.to_top)
 | 
					        btn_top.clicked.connect(Window.to_top)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        layout = QHBoxLayout()
 | 
					        container.addWidget(btn_hatch)
 | 
				
			||||||
        layout.addWidget(btn_hatch)
 | 
					        container.addWidget(btn_terminate)
 | 
				
			||||||
        layout.addWidget(btn_terminate)
 | 
					        container.addWidget(Window.speed)
 | 
				
			||||||
        layout.addWidget(Window.speed)
 | 
					        container.addWidget(btn_top)
 | 
				
			||||||
        layout.addWidget(btn_top)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Window.root.addLayout(layout)
 | 
					        root.setLayout(container)
 | 
				
			||||||
 | 
					        Window.root.addWidget(root)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def add_view() -> None:
 | 
					    def add_view() -> None:
 | 
				
			||||||
@@ -165,15 +167,20 @@ class Window:
 | 
				
			|||||||
    def to_top() -> None:
 | 
					    def to_top() -> None:
 | 
				
			||||||
        Window.scroll_area.verticalScrollBar().setValue(0)
 | 
					        Window.scroll_area.verticalScrollBar().setValue(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @staticmethod
 | 
				
			||||||
 | 
					    def to_bottom() -> None:
 | 
				
			||||||
 | 
					        Window.scroll_area.verticalScrollBar().setValue(
 | 
				
			||||||
 | 
					            Window.scroll_area.verticalScrollBar().maximum()
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def add_footer() -> None:
 | 
					    def add_footer() -> None:
 | 
				
			||||||
        root = QWidget()
 | 
					        root = QWidget()
 | 
				
			||||||
        root.setStyleSheet(f"background-color: {Config.footer_background_color};")
 | 
					        root.setContentsMargins(0, 0, 0, 0)
 | 
				
			||||||
        layout = QHBoxLayout()
 | 
					        container = QHBoxLayout()
 | 
				
			||||||
        Window.info = QLabel("---")
 | 
					        Window.info = SpecialButton("---")
 | 
				
			||||||
        Window.info.setWordWrap(True)
 | 
					        Window.info.clicked.connect(Window.to_bottom)
 | 
				
			||||||
        Window.info.setStyleSheet(f"font-size: {Config.footer_font_size}px;")
 | 
					 | 
				
			||||||
        Window.expand(Window.info)
 | 
					        Window.expand(Window.info)
 | 
				
			||||||
        layout.addWidget(Window.info)
 | 
					        container.addWidget(Window.info)
 | 
				
			||||||
        root.setLayout(layout)
 | 
					        root.setLayout(container)
 | 
				
			||||||
        Window.root.addWidget(root)
 | 
					        Window.root.addWidget(root)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user